Add configurable timeout calculation for transfers

Introduce timeout configuration and automatic timeout estimation for uploads/downloads. Added TimeoutConfig to OneBot config with baseTimeout, upload/downloadSpeedKBps and maxTimeout, plus calculateTimeout and capTimeout helpers. Applied estimation to FileApi.downloadFileById calls (GetFile, BaseDownloadStream) and to message sending (OneBotMsgApi) to compute timeouts from total payload size; sendMsg now accepts an optional timeout override which is capped by maxTimeout. Updated SendMsg payload schema to allow a custom timeout, and updated web UI store, types and config form to expose timeout settings and defaults.
This commit is contained in:
手瓜一十雪 committed 2026-03-12 15:01:34 +08:00
1 parent df0795f2c5
commit e9b74138d1
8 files changed
+173 -28

No files matched your search

@@ -19,6 +19,12 @@ const initialState: ConfigState = {
enableLocalFile2Url: false,
parseMultMsg: true,
imageDownloadProxy: '',
timeout: {
baseTimeout: 10000,
uploadSpeedKBps: 256,
downloadSpeedKBps: 256,
maxTimeout: 1800000,
},
},
};