subPromise wasn't resolving, avoid that

This commit is contained in:
Jonathan Staab 2023-05-09 13:21:15 -07:00
parent c2a0b8362e
commit c9b8a56f61

View File

@ -60,8 +60,6 @@ const load = ({relays, filter, onChunk = null, shouldProcess = true, timeout = 5
const allEvents = []
const attemptToComplete = async force => {
const sub = await subPromise
// If we've already unsubscribed we're good
if (completed) {
return
@ -78,7 +76,7 @@ const load = ({relays, filter, onChunk = null, shouldProcess = true, timeout = 5
}
if (isDone || force) {
sub.unsub()
subPromise.then(sub => sub.unsub())
resolve(allEvents)
completed = true
}