|
|
@ -155,14 +155,16 @@ Persistence.prototype.compactDatafile = function () { |
|
|
|
* @param {Number} interval in milliseconds, with an enforced minimum of 5 seconds |
|
|
|
* @param {Number} interval in milliseconds, with an enforced minimum of 5 seconds |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Persistence.prototype.setAutocompactionInterval = function (interval) { |
|
|
|
Persistence.prototype.setAutocompactionInterval = function (interval) { |
|
|
|
var self = this; |
|
|
|
var self = this |
|
|
|
|
|
|
|
, minInterval = 5000 |
|
|
|
|
|
|
|
, realInterval = Math.max(interval||0, minInterval) |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
if (interval < 5000) { interval = 5000; } |
|
|
|
|
|
|
|
this.stopAutocompaction(); |
|
|
|
this.stopAutocompaction(); |
|
|
|
|
|
|
|
|
|
|
|
this.autocompactionIntervalId = setInterval(function () { |
|
|
|
this.autocompactionIntervalId = setInterval(function () { |
|
|
|
self.compactDatafile(); |
|
|
|
self.compactDatafile(); |
|
|
|
}, interval); |
|
|
|
}, realInterval); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|