pixl-server-storage 3.1.0 → 3.1.1
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/package.json +1 -1
- package/storage.js +12 -10
- package/test/test-main.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixl-server-storage",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
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",
|
package/storage.js
CHANGED
|
@@ -670,6 +670,16 @@ module.exports = Class.create({
|
|
|
670
670
|
}
|
|
671
671
|
}; // deleteExpiredRecord
|
|
672
672
|
|
|
673
|
+
var doEngineMaint = function() {
|
|
674
|
+
// allow engine to run maint as well
|
|
675
|
+
self.engine.runMaintenance( function() {
|
|
676
|
+
stats.elapsed_sec = Tools.timeNow() - stats.time_start;
|
|
677
|
+
self.logDebug(3, "Daily maintenance complete");
|
|
678
|
+
self.logTransaction('maint', cleanup_list_path, stats);
|
|
679
|
+
if (callback) callback();
|
|
680
|
+
} );
|
|
681
|
+
}; // finish
|
|
682
|
+
|
|
673
683
|
this.listEach( cleanup_list_path,
|
|
674
684
|
function(item, item_idx, callback) {
|
|
675
685
|
// delete item if still expired
|
|
@@ -705,7 +715,7 @@ module.exports = Class.create({
|
|
|
705
715
|
// list iteration complete
|
|
706
716
|
if (err) {
|
|
707
717
|
self.logDebug(10, "Failed to load list, skipping maintenance (probably harmless)", cleanup_list_path);
|
|
708
|
-
|
|
718
|
+
doEngineMaint();
|
|
709
719
|
}
|
|
710
720
|
else {
|
|
711
721
|
// no error, delete list
|
|
@@ -713,15 +723,7 @@ module.exports = Class.create({
|
|
|
713
723
|
if (err) {
|
|
714
724
|
self.logError('maint', "Failed to delete cleanup list: " + cleanup_list_path + ": " + err);
|
|
715
725
|
}
|
|
716
|
-
|
|
717
|
-
// allow engine to run maint as well
|
|
718
|
-
self.engine.runMaintenance( function() {
|
|
719
|
-
stats.elapsed_sec = Tools.timeNow() - stats.time_start;
|
|
720
|
-
self.logDebug(3, "Daily maintenance complete");
|
|
721
|
-
self.logTransaction('maint', cleanup_list_path, stats);
|
|
722
|
-
if (callback) callback();
|
|
723
|
-
} );
|
|
724
|
-
|
|
726
|
+
doEngineMaint();
|
|
725
727
|
} ); // listDelete
|
|
726
728
|
} // succes
|
|
727
729
|
} // list complete
|
package/test/test-main.js
CHANGED
|
@@ -450,7 +450,7 @@ module.exports = {
|
|
|
450
450
|
test.ok( !!storageStream, "Got storage stream as 2nd arg");
|
|
451
451
|
test.ok( !!storageStream.pipe, "Storage stream has a pipe");
|
|
452
452
|
test.ok( !!streamInfo, "Info was provided as the 3rd arg");
|
|
453
|
-
test.ok( streamInfo.len ==
|
|
453
|
+
test.ok( streamInfo.len == 43, "Info has correct data length (expected 43, got " + streamInfo.len + ")");
|
|
454
454
|
test.ok( streamInfo.mod > 0, "Info has a non-zero mod date");
|
|
455
455
|
|
|
456
456
|
outStream.on('finish', function() {
|
|
@@ -497,7 +497,7 @@ module.exports = {
|
|
|
497
497
|
test.ok( !!storageStream, "Got storage stream as 2nd arg");
|
|
498
498
|
test.ok( !!storageStream.pipe, "Storage stream has a pipe");
|
|
499
499
|
test.ok( !!streamInfo, "Info was provided as the 3rd arg");
|
|
500
|
-
test.ok( streamInfo.len ==
|
|
500
|
+
test.ok( streamInfo.len == 43, "Info has correct data length (expected 43, got " + streamInfo.len + ")");
|
|
501
501
|
test.ok( streamInfo.mod > 0, "Info has a non-zero mod date");
|
|
502
502
|
|
|
503
503
|
outStream.on('finish', function() {
|
|
@@ -544,7 +544,7 @@ module.exports = {
|
|
|
544
544
|
test.ok( !!storageStream, "Got storage stream as 2nd arg");
|
|
545
545
|
test.ok( !!storageStream.pipe, "Storage stream has a pipe");
|
|
546
546
|
test.ok( !!streamInfo, "Info was provided as the 3rd arg");
|
|
547
|
-
test.ok( streamInfo.len ==
|
|
547
|
+
test.ok( streamInfo.len == 43, "Info has correct data length (expected 43, got " + streamInfo.len + ")");
|
|
548
548
|
test.ok( streamInfo.mod > 0, "Info has a non-zero mod date");
|
|
549
549
|
|
|
550
550
|
outStream.on('finish', function() {
|