Skip to content

Commit

Permalink
Make sure multicb done() is only called once
Browse files Browse the repository at this point in the history
  • Loading branch information
arj03 committed Apr 2, 2022
1 parent aa0fcea commit d58009d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,14 @@ module.exports = function (log, indexesPath) {
const index = newIndexes[indexName]
if (doneIndexing) indexes[indexName] = index
index.offset = offset
done(() => {
saveIndex(indexName, index, count)
})
}

done(() => {
for (var indexName in newIndexes) {
const index = newIndexes[indexName]
saveIndex(indexName, index, count)
}
})
}

const logstreamId = Math.ceil(Math.random() * 1000)
Expand Down

0 comments on commit d58009d

Please sign in to comment.