Исправление: Внедрен hot-reload (SIGHUP) для sing-box при обновлениях

This commit is contained in:
Dushnilin
2026-07-14 20:45:46 +03:00
parent 50cd1f59c9
commit f0d6af0d6f
2 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "fe-app-tachyon",
"version": "1.1.4",
"version": "1.1.5",
"license": "MIT",
"type": "module",
"scripts": {
+9 -7
View File
@@ -546,18 +546,20 @@ function reload_sing_box_runtime(previous_pid, config_hash_before, config_hash_a
}
previous_pid = sing_box_reload_previous_pid(previous_pid, config_hash_before, config_hash_after);
command_success_from_args([ "logger", "-t", "tachyon", "[info] Reloading sing-box runtime" ]);
if (!command_success_from_args([ "/etc/init.d/sing-box", "reload" ])) {
command_success_from_args([ "logger", "-t", "tachyon", "[fatal] Failed to reload sing-box. Aborted." ]);
command_success_from_args([ "logger", "-t", "tachyon", "[info] Hot-reloading sing-box runtime (SIGHUP) PID: " + previous_pid ]);
if (previous_pid > 0) {
if (!command_success_from_args([ "kill", "-HUP", as_string(previous_pid) ])) {
command_success_from_args([ "logger", "-t", "tachyon", "[fatal] Failed to send SIGHUP to sing-box. Aborted." ]);
exit(1);
}
let timeout = getenv("TACHYON_SING_BOX_RELOAD_PID_TIMEOUT") || "15";
if (previous_pid > 0 && !wait_sing_box_pid_replacement(previous_pid, timeout)) {
command_success_from_args([ "logger", "-t", "tachyon", "[fatal] sing-box reload did not replace the running process. Aborted." ]);
} else {
command_success_from_args([ "logger", "-t", "tachyon", "[info] sing-box is not running. Using start." ]);
if (!command_success_from_args([ "/etc/init.d/sing-box", "start" ])) {
command_success_from_args([ "logger", "-t", "tachyon", "[fatal] Failed to start sing-box. Aborted." ]);
exit(1);
}
}
}
function sing_box_service_running() {
let pid = sing_box_service_pid_runtime();