fix: ждать TCP-готовности proxy перед загрузкой отложенных подписок

run_deferred_subscription_bootstrap теперь после проверки что процесс
sing-box запущен дополнительно проверяет что proxy-порт реально принимает
соединения (до 10x3s).

Без этого: если порт не готов в момент вызова — fallback на прямой
download, что провалится для URL доступных только через proxy.
При неудаче через 30s запускается retry worker (поведение сохранено).

Также: get_subscription_download_proxy_address делает одиночную проверку
порта — retry worker является safety net для edge cases.
This commit is contained in:
Dushnilin
2026-08-10 18:27:38 +03:00
parent f5929d24f8
commit b11780dec3
2 changed files with 30 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "fe-app-tachyon",
"version": "1.2.68",
"version": "1.2.69",
"license": "MIT",
"type": "module",
"scripts": {
+29 -3
View File
@@ -2475,21 +2475,47 @@ function run_deferred_subscription_bootstrap(deferred_sections) {
return;
log_message("Waiting for sing-box service proxy before retrying deferred subscription rule(s): " + deferred_sections, "info");
let ready = false;
let process_ready = false;
for (let attempt = 1; attempt <= 10; attempt++) {
if (sing_box_service_running()) {
ready = true;
process_ready = true;
break;
}
system("sleep 1");
}
if (!ready) {
if (!process_ready) {
log_message("sing-box service proxy did not become ready in time; deferred subscription rule(s) will remain disabled until the next successful subscription update", "warn");
start_deferred_subscription_bootstrap_retry_worker(deferred_sections);
return;
}
// Wait for the proxy port to actually accept TCP connections — the sing-box
// process may be running but the mixed inbound port not yet ready. Without
// this check, the deferred download falls back to a direct connection that
// may fail for subscription URLs only reachable through the proxy.
let proxy_address = SB_SERVICE_MIXED_INBOUND_ADDRESS + ":" + SB_SERVICE_MIXED_INBOUND_PORT;
let port_ready = false;
for (let attempt = 1; attempt <= 10; attempt++) {
let probe = command_status_from_args([
"curl", "-s", "--connect-timeout", "2", "-m", "4",
"-x", "http://" + proxy_address, "http://1.1.1.1/", "-o", "/dev/null"
]);
if (probe != 7 && probe != 28) {
log_message("Service proxy is ready for deferred subscription bootstrap", "info");
port_ready = true;
break;
}
log_message("Service proxy port not yet ready for deferred bootstrap [" + attempt + "/10]", "info");
system("sleep 3");
}
if (!port_ready) {
log_message("Service proxy port is not accepting connections; starting bootstrap retry worker for: " + deferred_sections, "warn");
start_deferred_subscription_bootstrap_retry_worker(deferred_sections);
return;
}
let result = subscription_bootstrap_retry_result(deferred_sections);
if (result.recovered != "") {
log_message("Recovered deferred subscription rule(s): " + result.recovered + "; scheduling Tachyon reload", "info");