fix(migration): declare write_cache_format_file before ensure_runtime_cache_format (no hoisting in ucode)

This commit is contained in:
Dushnilin
2026-08-14 10:41:00 +03:00
parent 464dcebc50
commit 5be411994c
+7 -7
View File
@@ -1486,6 +1486,13 @@ function ensure_runtime_dirs() {
ensure_dir(TACHYON_SECTION_CACHE_DIR);
}
function write_cache_format_file(path, format) {
let tmp = path + ".tmp";
if (fs.writefile(tmp, format + "\n") == null)
return null;
return fs.rename(tmp, path) ? path : null;
}
function ensure_runtime_cache_format() {
ensure_dir(TACHYON_RUNTIME_STATE_DIR);
@@ -1508,13 +1515,6 @@ function ensure_runtime_cache_format() {
}
}
function write_cache_format_file(path, format) {
let tmp = path + ".tmp";
if (fs.writefile(tmp, format + "\n") == null)
return null;
return fs.rename(tmp, path) ? path : null;
}
function remove_legacy_server_country_cache() {
// Absent file already satisfies the caller; fs.unlink throws on ENOENT.
try { fs.unlink(TACHYON_RUNTIME_STATE_DIR + "/server-country-cache.json"); } catch(e) {}