Comparing version 6.0.27 to 6.0.28
19
index.js
@@ -53,2 +53,3 @@ const b4a = require('b4a') | ||
this._tryLoadingLocal = true | ||
this._primaryBootstrap = null | ||
@@ -885,2 +886,8 @@ if (this.bootstrap) { | ||
async _loadLocalWriter (sys) { | ||
if (this.localWriter !== null) return | ||
await this._getWriterByKey(this.local.key, -1, 0, false, sys) | ||
this._tryLoadingLocal = false | ||
} | ||
async _bootstrapLinearizer () { | ||
@@ -900,2 +907,4 @@ const bootstrap = this._makeWriter(this.bootstrap, 0, true) | ||
async _makeLinearizer (sys) { | ||
this._tryLoadingLocal = true | ||
if (sys === null) { | ||
@@ -905,4 +914,5 @@ return this._bootstrapLinearizer() | ||
// always load local to see if relevant... | ||
await this._getWriterByKey(this.local.key, -1, 0, false, sys) | ||
if (this.opened || await sys.hasLocal(this.local.key)) { | ||
await this._loadLocalWriter(sys) | ||
} | ||
@@ -1052,2 +1062,7 @@ const indexers = [] | ||
if (this.localWriter === null && this._tryLoadingLocal === true) { | ||
// in case we cleared system blocks we need to defer loading of the local writer | ||
await this._loadLocalWriter(this.system) | ||
} | ||
const remoteAdded = await this._addRemoteHeads() | ||
@@ -1054,0 +1069,0 @@ const localNodes = this._appending === null ? null : this._addLocalHeads() |
@@ -357,2 +357,11 @@ const Hyperbee = require('hyperbee') | ||
async hasLocal (key) { | ||
try { | ||
const node = await this.db.get(key, { valueEncoding: Member, keyEncoding: MEMBERS, update: false, wait: false }) | ||
return node !== null | ||
} catch { | ||
return false | ||
} | ||
} | ||
async getLocalLength (key) { | ||
@@ -359,0 +368,0 @@ try { |
{ | ||
"name": "autobase", | ||
"version": "6.0.27", | ||
"version": "6.0.28", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
175328
4709