|
334 | 334 | right-icon="tips" |
335 | 335 | @click-right-icon="githubApiTimeoutTips" |
336 | 336 | /> |
| 337 | + <nut-input |
| 338 | + class="input" |
| 339 | + v-model="backendRequestConcurrencyInput" |
| 340 | + :disabled="!isRequestConfigEditing" |
| 341 | + :placeholder="$t(`myPage.placeholder.backendRequestConcurrency`)" |
| 342 | + type="number" |
| 343 | + input-align="left" |
| 344 | + :left-icon="iconConcurrency" |
| 345 | + right-icon="tips" |
| 346 | + @click-right-icon="backendRequestConcurrencyTips" |
| 347 | + /> |
| 348 | + <nut-input |
| 349 | + class="input" |
| 350 | + v-model="backendRequestConcurrencyWaitTimeInput" |
| 351 | + :disabled="!isRequestConfigEditing" |
| 352 | + :placeholder="$t(`myPage.placeholder.backendRequestConcurrencyWaitTime`)" |
| 353 | + type="number" |
| 354 | + input-align="left" |
| 355 | + :left-icon="iconTimeout" |
| 356 | + right-icon="tips" |
| 357 | + @click-right-icon="backendRequestConcurrencyWaitTimeTips" |
| 358 | + /> |
337 | 359 | </div> |
338 | 360 | </div> |
339 | 361 | <div class="config-card"> |
@@ -629,7 +651,7 @@ const router = useRouter(); |
629 | 651 | const { showNotify } = useAppNotifyStore(); |
630 | 652 | const { currentUrl: host } = useHostAPI(); |
631 | 653 | const settingsStore = useSettingsStore(); |
632 | | -const { githubUser, gistToken, syncTime, defaultUserAgent, defaultFlowUserAgent, defaultProxy, defaultTimeout, cacheThreshold, resourceCacheTtl, headersCacheTtl, scriptCacheTtl, logsMaxCount, syncPlatform, githubProxy, githubApiUrl, githubApiTimeout, artifactSyncBatchSize, githubProxyRegex, gistUpload } = |
| 654 | +const { githubUser, gistToken, syncTime, defaultUserAgent, defaultFlowUserAgent, defaultProxy, defaultTimeout, backendRequestConcurrency, backendRequestConcurrencyWaitTime, cacheThreshold, resourceCacheTtl, headersCacheTtl, scriptCacheTtl, logsMaxCount, syncPlatform, githubProxy, githubApiUrl, githubApiTimeout, artifactSyncBatchSize, githubProxyRegex, gistUpload } = |
633 | 655 | storeToRefs(settingsStore); |
634 | 656 |
|
635 | 657 | const DEFAULT_GITHUB_API_URL = "https://api.github.com"; |
@@ -748,6 +770,8 @@ const uaInput = ref(""); |
748 | 770 | const flowUaInput = ref(""); |
749 | 771 | const proxyInput = ref(""); |
750 | 772 | const timeoutInput = ref(""); |
| 773 | +const backendRequestConcurrencyInput = ref(""); |
| 774 | +const backendRequestConcurrencyWaitTimeInput = ref(""); |
751 | 775 | const cacheThresholdInput = ref(""); |
752 | 776 | const resourceCacheTtlInput = ref(""); |
753 | 777 | const headersCacheTtlInput = ref(""); |
@@ -783,6 +807,8 @@ const toggleEditMode = async (type) => { |
783 | 807 | defaultFlowUserAgent: flowUaInput.value, |
784 | 808 | defaultProxy: proxyInput.value, |
785 | 809 | defaultTimeout: timeoutInput.value, |
| 810 | + backendRequestConcurrency: backendRequestConcurrencyInput.value, |
| 811 | + backendRequestConcurrencyWaitTime: backendRequestConcurrencyWaitTimeInput.value, |
786 | 812 | cacheThreshold: cacheThresholdInput.value, |
787 | 813 | resourceCacheTtl: resourceCacheTtlInput.value, |
788 | 814 | headersCacheTtl: headersCacheTtlInput.value, |
@@ -812,6 +838,8 @@ const toggleEditMode = async (type) => { |
812 | 838 | flowUaInput.value = defaultFlowUserAgent.value || ""; |
813 | 839 | proxyInput.value = defaultProxy.value; |
814 | 840 | timeoutInput.value = defaultTimeout.value; |
| 841 | + backendRequestConcurrencyInput.value = backendRequestConcurrency.value || ""; |
| 842 | + backendRequestConcurrencyWaitTimeInput.value = backendRequestConcurrencyWaitTime.value || ""; |
815 | 843 | cacheThresholdInput.value = cacheThreshold.value; |
816 | 844 | resourceCacheTtlInput.value = resourceCacheTtl.value; |
817 | 845 | headersCacheTtlInput.value = headersCacheTtl.value; |
@@ -972,6 +1000,8 @@ const setDisplayInfo = () => { |
972 | 1000 | flowUaInput.value = defaultFlowUserAgent.value || ""; |
973 | 1001 | proxyInput.value = defaultProxy.value || ""; |
974 | 1002 | timeoutInput.value = defaultTimeout.value || ""; |
| 1003 | + backendRequestConcurrencyInput.value = backendRequestConcurrency.value || ""; |
| 1004 | + backendRequestConcurrencyWaitTimeInput.value = backendRequestConcurrencyWaitTime.value || ""; |
975 | 1005 | cacheThresholdInput.value = cacheThreshold.value || ""; |
976 | 1006 | resourceCacheTtlInput.value = resourceCacheTtl.value || ""; |
977 | 1007 | headersCacheTtlInput.value = headersCacheTtl.value || ""; |
@@ -1266,6 +1296,30 @@ const timeoutTips = () => { |
1266 | 1296 | lockScroll: false, |
1267 | 1297 | }); |
1268 | 1298 | }; |
| 1299 | +const backendRequestConcurrencyTips = () => { |
| 1300 | + Dialog({ |
| 1301 | + title: '后端请求并发数', |
| 1302 | + content: '后端需 >= 2.23.32\n\n控制后端发起外部请求时的并发数。默认 10;在代理 App 中建议不超过 20,过高可能增加连接数和内存压力。\n\n实际会用于远程资源下载,例如远程订阅、文件、脚本、预览、同步/定时同步等经后端下载工具发起的请求;也会用于订阅流量信息请求,例如 Subscription-Userinfo 的 HEAD/GET 请求。\n\n域名解析除外,它有自己的请求并发数。\n\n后端日志会输出 [Backend Request Concurrency],包含 active、pending、limit、waitTime,方便调试。', |
| 1303 | + popClass: 'auto-dialog', |
| 1304 | + textAlign: 'left', |
| 1305 | + okText: 'OK', |
| 1306 | + noCancelBtn: true, |
| 1307 | + closeOnPopstate: true, |
| 1308 | + lockScroll: false, |
| 1309 | + }); |
| 1310 | +}; |
| 1311 | +const backendRequestConcurrencyWaitTimeTips = () => { |
| 1312 | + Dialog({ |
| 1313 | + title: '后端请求并发等待时间', |
| 1314 | + content: '后端需 >= 2.23.32\n\n每个受后端请求并发数限制的请求拿到并发槽后,先等待指定毫秒数再发出。默认 0。\n\n可用于降低代理 App 中后端请求的瞬时连接压力;数值越大,总处理耗时也会越长。\n\n作用范围与后端请求并发数一致:远程资源下载和订阅流量信息请求。域名解析除外,它有自己的请求并发数。', |
| 1315 | + popClass: 'auto-dialog', |
| 1316 | + textAlign: 'left', |
| 1317 | + okText: 'OK', |
| 1318 | + noCancelBtn: true, |
| 1319 | + closeOnPopstate: true, |
| 1320 | + lockScroll: false, |
| 1321 | + }); |
| 1322 | +}; |
1269 | 1323 | const cacheThresholdTips = () => { |
1270 | 1324 | Dialog({ |
1271 | 1325 | title: '可尝试设置为 1024', |
@@ -1324,7 +1378,7 @@ const logsMaxCountTips = () => { |
1324 | 1378 | const concurrencyTips = () => { |
1325 | 1379 | Dialog({ |
1326 | 1380 | title: '并发数', |
1327 | | - content: 'Shadowrocket 并发可能会爆内存, 可设为 1', |
| 1381 | + content: 'Shadowrocket/Surge 等代理 App 中并发数太高可能会爆内存, 可自行调整', |
1328 | 1382 | popClass: 'auto-dialog', |
1329 | 1383 | okText: 'OK', |
1330 | 1384 | noCancelBtn: true, |
|
0 commit comments