1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure fs context cache is flushed on close

Fixes #2001
This commit is contained in:
Nick O'Leary 2018-12-13 12:46:19 +00:00
parent 46a8d96997
commit 978f4ecc58
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -209,6 +209,7 @@ LocalFileSystem.prototype.open = function(){
}
});
} else {
self._flushPendingWrites = function() { }
return fs.ensureDir(self.storageBaseDir);
}
}
@ -219,6 +220,12 @@ LocalFileSystem.prototype.close = function(){
clearTimeout(this._pendingWriteTimeout);
delete this._pendingWriteTimeout;
this.flushInterval = 0;
self.writePromise = self.writePromise.then(function(){
return self._flushPendingWrites.call(self).catch(function(err) {
log.error(log._("context.localfilesystem.error-write",{message:err.toString()}));
});
});
}
return this.writePromise;
}