pixl-server-storage 3.2.3 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/engines/SQLite.js +28 -14
- package/package.json +1 -1
package/engines/SQLite.js
CHANGED
|
@@ -465,25 +465,39 @@ module.exports = Class.create({
|
|
|
465
465
|
} );
|
|
466
466
|
}; // compress
|
|
467
467
|
|
|
468
|
-
// Perform the backup --
|
|
469
|
-
//
|
|
468
|
+
// Perform the backup -- as long as WAL mode is enabled, this should only acquire a shared lock on the DB
|
|
469
|
+
// allowing reads and writes to continue (albeit slowly), and NOT be included in the backup
|
|
470
|
+
// see: https://sqlite.org/forum/forumpost/95c0e12f4c
|
|
470
471
|
perf.begin('backup');
|
|
471
472
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
473
|
+
var db = this.db;
|
|
474
|
+
var backup = db.backup(file);
|
|
475
|
+
backup.step(-1);
|
|
476
|
+
|
|
477
|
+
var timer = setInterval( function() {
|
|
478
|
+
if (backup.idle) {
|
|
479
|
+
backup.step(-1);
|
|
478
480
|
}
|
|
479
481
|
|
|
480
|
-
|
|
482
|
+
if (backup.completed) {
|
|
483
|
+
perf.end('backup');
|
|
484
|
+
clearTimeout(timer);
|
|
485
|
+
self.logDebug(6, "SQLite backup operation completed: " + file);
|
|
486
|
+
|
|
487
|
+
// now compress or keep or done
|
|
488
|
+
if (backups.compress) compress();
|
|
489
|
+
else if (backups.keep) keep();
|
|
490
|
+
else finish();
|
|
491
|
+
}
|
|
481
492
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
493
|
+
if (backup.failed) {
|
|
494
|
+
perf.end('backup');
|
|
495
|
+
clearTimeout(timer);
|
|
496
|
+
self.logError('backup', "SQLite backup operation failed. Please check permissions and available disk space.");
|
|
497
|
+
fs.unlink(file, noop);
|
|
498
|
+
finish();
|
|
499
|
+
}
|
|
500
|
+
}, 10 );
|
|
487
501
|
},
|
|
488
502
|
|
|
489
503
|
shutdown: function(callback) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixl-server-storage",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "A key/value/list storage component for the pixl-server framework.",
|
|
5
5
|
"author": "Joseph Huckaby <jhuckaby@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/jhuckaby/pixl-server-storage",
|