@live-change/db
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -73,7 +73,12 @@ const OpLogger = require('./OpLogger.js') | ||
if(!opLogStart) return { count: 0, last: "\xFF\xFF\xFF\xFF" } | ||
const logId = this.opLogWritter({ | ||
type: 'clearOpLog', | ||
from: opLogStart.id, | ||
to: nowStr | ||
}) | ||
let logId | ||
try { | ||
logId = this.opLogWritter({ | ||
type: 'clearOpLog', | ||
from: opLogStart.id, | ||
to: nowStr | ||
}) | ||
} catch(e) { // impossible to put anything - database full - first delete something | ||
logId = null | ||
} | ||
const removedStats = await this.opLog.rangeDelete({ | ||
@@ -83,2 +88,9 @@ lt: nowStr, | ||
}) | ||
if(!logId) { // Panic mode | ||
logId = this.opLogWritter({ | ||
type: 'clearOpLog', | ||
from: opLogStart.id, | ||
to: nowStr | ||
}) | ||
} | ||
const opLogNewStart = (await this.opLog.rangeGet({ gt: '', limit: 1 }))[0] | ||
@@ -85,0 +97,0 @@ if(opLogNewStart) { |
{ | ||
"name": "@live-change/db", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Database with observable data for live queries", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
72534
2209