Skip to content

Commit

Permalink
fix: memory leak in DataStore (#950)
Browse files Browse the repository at this point in the history
We have a set of promises waiting to be indexed, and we never removed
these promises from the set. This fixes that memory leak.
  • Loading branch information
EvanHahn authored Oct 30, 2024
1 parent 5aa2618 commit 4a7bf54
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/datastore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export class DataStore extends TypedEmitter {
const deferred = pDefer()
this.#pendingIndex.set(versionId, deferred)
await deferred.promise
this.#pendingIndex.delete(versionId)

return /** @type {Extract<MapeoDoc, TDoc>} */ (
decode(block, { coreDiscoveryKey, index })
Expand Down

0 comments on commit 4a7bf54

Please sign in to comment.