Make sure that node-persist write do not crash the program

This commit is contained in:
Marco van Dijk 2024-12-01 17:49:25 +01:00
parent 8c804e7de7
commit 2547a026e7

View File

@ -120,14 +120,24 @@ async function processQueue() {
}
} else {
if (staleENSCache) {
console.log("Writing ENS cache to disk");
await writeToStorage("ensDomainCache", ensDomainCache);
staleENSCache = false;
try {
console.log("Writing ENS cache to disk");
await writeToStorage("ensDomainCache", ensDomainCache);
staleENSCache = false;
} catch (err) {
console.log(err);
console.log("Error writing to storage...");
}
}
if (staleOrchCache) {
console.log("Writing Orchestrator cache to disk");
await writeToStorage("orchCache", orchCache);
staleOrchCache = false;
try {
console.log("Writing Orchestrator cache to disk");
await writeToStorage("orchCache", orchCache);
staleOrchCache = false;
} catch (err) {
console.log(err);
console.log("Error writing to storage...");
}
}
await sleep(1000);
}