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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user