mirror of
https://github.com/stronk-dev/OrchestratorTracker.git
synced 2025-07-05 10:55:09 +02:00
Try this to deal with the wonky node-persist library.
This commit is contained in:
parent
e779bbc393
commit
ca7ff2ef55
@ -162,11 +162,11 @@ async function recoverStorage(initPrometheus) {
|
|||||||
console.log("Initialized Prometheus state.");
|
console.log("Initialized Prometheus state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeToStorage(key, data) {
|
async function writeToStorage(key, data) {
|
||||||
try {
|
try {
|
||||||
const serialized = JSON.stringify(data);
|
const serialized = JSON.stringify(data);
|
||||||
if (!serialized) throw new Error("Invalid JSON data");
|
if (!serialized || !serialized.length) throw new Error("Invalid JSON data");
|
||||||
storage.setItem(key, JSON.parse(serialized));
|
await storage.setItem(key, JSON.parse(serialized));
|
||||||
console.log(`Stored data for key: ${key}`);
|
console.log(`Stored data for key: ${key}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Error writing to storage for key: ${key}`, err.message);
|
console.error(`Error writing to storage for key: ${key}`, err.message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user