fix stack overflow

pull/53/head
Chris Wendt 10 months ago
parent 68279ccdf0
commit c2b7768c8a
  1. 4
      lib/datastore.js

@ -668,7 +668,7 @@ class Datastore extends EventEmitter {
* @private * @private
*/ */
async _getCandidatesAsync (query, dontExpireStaleDocs = false) { async _getCandidatesAsync (query, dontExpireStaleDocs = false) {
const validDocs = [] let validDocs = []
// STEP 1: get candidates list by checking indexes from most to least frequent usecase // STEP 1: get candidates list by checking indexes from most to least frequent usecase
const docs = this._getRawCandidates(query) const docs = this._getRawCandidates(query)
@ -684,7 +684,7 @@ class Datastore extends EventEmitter {
for (const _id of expiredDocsIds) { for (const _id of expiredDocsIds) {
await this._removeAsync({ _id }, {}) await this._removeAsync({ _id }, {})
} }
} else validDocs.push(...docs) } else validDocs = docs
return validDocs return validDocs
} }

Loading…
Cancel
Save