@nxtedition/rocksdb 7.0.59 → 7.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -349,8 +349,11 @@ class RocksLevel extends AbstractLevel {
|
|
|
349
349
|
for await (const update of db[kUpdates](options)) {
|
|
350
350
|
if (first) {
|
|
351
351
|
if (update.sequence > options.since) {
|
|
352
|
+
// HACK
|
|
352
353
|
db.emit('warning', `Invalid update sequence ${update.sequence} > ${options.since}. Starting from 0.`)
|
|
353
|
-
|
|
354
|
+
for await (const update of db[kUpdates]({ ...options, since: 0 })) {
|
|
355
|
+
yield update
|
|
356
|
+
}
|
|
354
357
|
break
|
|
355
358
|
} else {
|
|
356
359
|
first = false
|
|
@@ -358,12 +361,6 @@ class RocksLevel extends AbstractLevel {
|
|
|
358
361
|
}
|
|
359
362
|
yield update
|
|
360
363
|
}
|
|
361
|
-
|
|
362
|
-
if (first === null) {
|
|
363
|
-
for await (const update of db[kUpdates]({ ...options, since: 0 })) {
|
|
364
|
-
yield update
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
364
|
}
|
|
368
365
|
|
|
369
366
|
try {
|
|
@@ -421,7 +418,16 @@ class RocksLevel extends AbstractLevel {
|
|
|
421
418
|
return
|
|
422
419
|
}
|
|
423
420
|
|
|
421
|
+
let first = true
|
|
424
422
|
for await (const update of buffer) {
|
|
423
|
+
if (first) {
|
|
424
|
+
if (update.sequence > since) {
|
|
425
|
+
// HACK
|
|
426
|
+
db.emit('warning', `Invalid batch sequence. Restarting.`)
|
|
427
|
+
break
|
|
428
|
+
}
|
|
429
|
+
first = false
|
|
430
|
+
}
|
|
425
431
|
if (update.sequence >= since) {
|
|
426
432
|
yield update
|
|
427
433
|
since = update.sequence + update.count
|