mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 07:04:53 +09:00
Fix getting trolled by partial autosaves (.tmp.zip)
This commit is contained in:
1 parent
36bfd6450b
commit
d4968e0894
2 files changed
+6
-3
No files matched your search
@@ -8,6 +8,7 @@ var request = require("request")
|
||||
var ncp = require('ncp').ncp;
|
||||
var Rcon = require('simple-rcon');
|
||||
var hashFiles = require('hash-files');
|
||||
var findRemoveSync = require('find-remove');
|
||||
|
||||
// require config.json
|
||||
var config = require('./config');
|
||||
@@ -162,11 +163,12 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
|
||||
} else {
|
||||
process.exit(1)
|
||||
}
|
||||
console.log("Deleting .tmp.zip files");
|
||||
findRemoveSync(instancedirectory + "/saves", {extensions: ['.tmp.zip']})
|
||||
|
||||
console.log("Deleting logs");
|
||||
// clean old log file to avoid crash
|
||||
// file exists, delete so we don't get in trouble
|
||||
|
||||
try {
|
||||
fs.unlinkSync(instancedirectory+'/factorio-current.log')
|
||||
} catch (err){
|
||||
@@ -493,7 +495,7 @@ function instanceManagement() {
|
||||
sadas = JSON.stringify(confirmedOrders)
|
||||
confirmedOrders = [];
|
||||
// send our RCON command with whatever we got
|
||||
client.exec("/silent-command remote.call('clusterio', 'importMany', '" + sadas + "')");
|
||||
messageInterface("/silent-command remote.call('clusterio', 'importMany', '" + sadas + "')");
|
||||
}
|
||||
}, 3000)
|
||||
// COMBINATOR SIGNALS ---------------------------------------------------------
|
||||
@@ -510,7 +512,7 @@ function instanceManagement() {
|
||||
}
|
||||
inventoryFrame["signal-unixtime"] = Math.floor(Date.now()/1000);
|
||||
// console.log("RCONing inventory! " + JSON.stringify(inventoryFrame));
|
||||
client.exec("/silent-command remote.call('clusterio', 'receiveInventory', '" + JSON.stringify(inventoryFrame) + "')");
|
||||
messageInterface("/silent-command remote.call('clusterio', 'receiveInventory', '" + JSON.stringify(inventoryFrame) + "')");
|
||||
}
|
||||
});
|
||||
}, 1000)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"child_process": "^1.0.2",
|
||||
"express": "^4.14.0",
|
||||
"express-fileupload": "0.0.6",
|
||||
"find-remove": "^1.0.0",
|
||||
"follow-redirects": "^1.2.1",
|
||||
"fs": "0.0.2",
|
||||
"fs-extra": "^1.0.0",
|
||||
|
||||
Reference in new issue
Block a user