Skip to content

Commit

Permalink
only set local length if lookup succeeds (#165)
Browse files Browse the repository at this point in the history
* only set local length if lookup succeeds

* catch lookup error

* catch after making promise
  • Loading branch information
chm-diederichs authored Jul 29, 2024
1 parent bf52c7c commit 17acfd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,7 @@ module.exports = class Autobase extends ReadyResource {
!system.sameIndexers(this.linearizer.indexers)

const localLookup = this.localWriter ? system.get(this.local.key, { timeout }) : null
if (localLookup) localLookup.catch(noop)

const indexers = []
const pendingViews = []
Expand Down Expand Up @@ -1638,8 +1639,7 @@ module.exports = class Autobase extends ReadyResource {

if (localLookup) {
const value = await localLookup
if (value) info.localLength = value.length
if (value.isRemoved) info.localLength = -1
if (value) info.localLength = value.isRemoved ? -1 : value.length
}

const closing = []
Expand Down

0 comments on commit 17acfd8

Please sign in to comment.