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 { } else {
if (staleENSCache) { if (staleENSCache) {
console.log("Writing ENS cache to disk"); try {
await writeToStorage("ensDomainCache", ensDomainCache); console.log("Writing ENS cache to disk");
staleENSCache = false; await writeToStorage("ensDomainCache", ensDomainCache);
staleENSCache = false;
} catch (err) {
console.log(err);
console.log("Error writing to storage...");
}
} }
if (staleOrchCache) { if (staleOrchCache) {
console.log("Writing Orchestrator cache to disk"); try {
await writeToStorage("orchCache", orchCache); console.log("Writing Orchestrator cache to disk");
staleOrchCache = false; await writeToStorage("orchCache", orchCache);
staleOrchCache = false;
} catch (err) {
console.log(err);
console.log("Error writing to storage...");
}
} }
await sleep(1000); await sleep(1000);
} }