You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like it is more correct to accumulate all changes and write them in a single write-to-disk and count timeout only from the last change (i.e. if timeout is set to 200 and multiple changes occur every 100 - then write when thery stop in a single bulk).
Or such an option would be appropriate alongside with writeDelay (say debounceDelay or something).
Looks like it is more correct to accumulate all changes and write them in a single write-to-disk and count timeout only from the last change (i.e. if timeout is set to 200 and multiple changes occur every 100 - then write when thery stop in a single bulk).
Or such an option would be appropriate alongside with writeDelay (say debounceDelay or something).
const trivialdb = require('trivialdb');
const tdbFslib = require('trivialdb/lib/fslib');
let wvi = 0, wvts = Date.now();
const tdb = tns.db("test", {
writeDelay: 200,
writeFunc: (path, str) => { console.log("W", ++wvi, wvts-Date.now(), str.length, "chars"); return tdbFslib.writeDB(path, str); }
});
tdb.loading.then(() => {
console.log('loaded.');
tdb.save({first: '1', last: 'a'})
.then(tdb.save.bind(tdb, {first: "2", last: "b"}, undefined))
.then(tdb.save.bind(tdb, {first: "3", last: "c"}, undefined))
.then(tdb.save.bind(tdb, {first: "4", last: "d"}, undefined))
;
});
loaded.
W 1 -203 85 chars
W 2 -208 168 chars
W 3 -210 251 chars
W 4 -212 334 chars
The text was updated successfully, but these errors were encountered: