From 2547a026e78feddd706a2a72b3715cf6a4821687 Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Sun, 1 Dec 2024 17:49:25 +0100 Subject: [PATCH] Make sure that node-persist write do not crash the program --- master/worker.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/master/worker.js b/master/worker.js index eefacd7..3a414a7 100644 --- a/master/worker.js +++ b/master/worker.js @@ -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); }