fix: file handle safety, orphan cleanup, error logging edge cases

generator.uc: try/catch around hosts cache file read with guaranteed close
hosts.uc: try/catch around parse_hosts_file with guaranteed close
migration.uc: try/catch around remove_cache_path, checked unlink in remove_legacy
runtime.uc: cleanup stale temp config files on init_config startup
lifecycle.uc: log warning on nft table delete failure in stop_main
This commit is contained in:
Dushnilin
2026-08-03 20:06:18 +03:00
parent 4e12681179
commit a3f877c960
11 changed files with 133 additions and 62 deletions
+9 -5
View File
@@ -1442,15 +1442,19 @@ function ensure_runtime_cache_format() {
}
function remove_legacy_server_country_cache() {
fs.unlink(TACHYON_RUNTIME_STATE_DIR + "/server-country-cache.json");
try { fs.unlink(TACHYON_RUNTIME_STATE_DIR + "/server-country-cache.json"); } catch(e) {}
}
function remove_cache_path(path) {
path = as_string(path);
if (index(path, "*") >= 0)
run("rm -f " + shell_quote(path));
else
fs.unlink(path);
try {
if (index(path, "*") >= 0)
run("rm -f " + shell_quote(path));
else
fs.unlink(path);
} catch(e) {
log_message("Failed to remove cache path: " + path, "warn");
}
}
function apply_operations(cursor, operations) {