From ca2967e25519968f8a35ca44945ee0f8defb0c09 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 18 Nov 2019 14:26:33 +0100 Subject: [PATCH] Fix clusterioMod item autosaving Fix the autosave code being broken by the move in e4aae88. --- sharedPlugins/clusterioMod/masterPlugin.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sharedPlugins/clusterioMod/masterPlugin.js b/sharedPlugins/clusterioMod/masterPlugin.js index 7151b257..efbd75ce 100644 --- a/sharedPlugins/clusterioMod/masterPlugin.js +++ b/sharedPlugins/clusterioMod/masterPlugin.js @@ -51,11 +51,8 @@ class masterPlugin { async onLoadFinish() { this.items = await loadDatabase(this.config); - this.autosaveId = setInterval(async function() { - let file = path.join(this.config.databaseDirectory, "items.json"); - console.log(`autosaving ${file}`); - let content = JSON.stringify(db.items.serialize()); - await fs.outputFile(file, content); + this.autosaveId = setInterval(async () => { + await saveDatabase(this.config, this.items); },this.config.autosaveInterval || 60000); routes.addApiRoutes(