File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import { Persistency } from "persistency";
2828
2929const persistency = new Persistency ({
3030 folder: " /path/to/data/folder" ,
31- reclaimTimeout : 10000 // Milliseconds. Optional. 10 seconds by default. Set to 0 or negative to directly delete old entries without any waiting
31+ reclaimDelay : 10000 // Milliseconds. Optional. 10 seconds by default. Set to 0 or negative to directly delete old entries without any waiting
3232});
3333
3434// The library works with buffers, so you can use any serialization library, like pacopack
Original file line number Diff line number Diff line change 11{
22 "name" : " persistency" ,
3- "version" : " 1.0.1 " ,
3+ "version" : " 1.0.2 " ,
44 "description" : " The lightweight resilient persistency library" ,
55 "main" : " lib/" ,
66 "types" : " lib/types" ,
Original file line number Diff line number Diff line change @@ -71,7 +71,14 @@ export class Persistency {
7171 } ;
7272 this . entriesFile = Path . join ( options . folder , "entries.db" ) ;
7373 this . dataFile = Path . join ( options . folder , "data.db" ) ;
74- this . reclaimTimeout = options . reclaimTimeout != null ? options . reclaimTimeout : 10000 ;
74+ if ( options . reclaimDelay == null ) {
75+ this . reclaimDelay = 10000 ;
76+ } else if ( options . reclaimDelay > 0 ) {
77+ this . reclaimDelay = options . reclaimDelay ;
78+ } else {
79+ this . reclaimDelay = 0 ;
80+ this . _context . now = ( ) => 0 ; // Avoids overhead and applying delays because of clock synchronizing forwards/backwards
81+ }
7582 this . _fd = this . _loadDataSync ( ) ;
7683 this . _checkReclaim ( ) ;
7784 this . _compact ( ) ;
You can’t perform that action at this time.
0 commit comments