@alcalzone/jsonl-db
Advanced tools
Comparing version
@@ -182,11 +182,11 @@ "use strict"; | ||
async compress() { | ||
if (!this._writeBacklog) | ||
return; | ||
await this.dump(); | ||
// After dumping, restart the write thread so no duplicate entries get written | ||
if (this._writeBacklog) { | ||
this._closeDBPromise = deferred_promise_1.createDeferredPromise(); | ||
// Disable writing into the backlog stream | ||
this._writeBacklog.end(); | ||
this._writeBacklog = undefined; | ||
await this._closeDBPromise; | ||
} | ||
this._closeDBPromise = deferred_promise_1.createDeferredPromise(); | ||
// Disable writing into the backlog stream | ||
this._writeBacklog.end(); | ||
this._writeBacklog = undefined; | ||
await this._closeDBPromise; | ||
// Replace the aof file | ||
@@ -193,0 +193,0 @@ await fs.move(this.filename, this.filename + ".bak"); |
{ | ||
"name": "@alcalzone/jsonl-db", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Simple JSONL-based key-value store", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -55,2 +55,5 @@ # jsonl-db | ||
### 0.1.2 (2020-04-25) | ||
* `compress()` no longer overwrites the main file while the DB is being closed | ||
### 0.1.1 (2020-04-25) | ||
@@ -57,0 +60,0 @@ * Fixed some race conditions |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24981
0.39%64
4.92%