Skip to content

Commit

Permalink
lmdb: hotfix for leaked goroutine.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Oct 6, 2024
1 parent 14c3818 commit 1f67814
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lmdb/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,13 @@ func (b *LMDBBackend) QueryEvents(ctx context.Context, filter nostr.Filter) (cha
// first pass
emitQueue := make(priorityQueue, 0, len(queries))
for _, q := range queries {
evt, ok := <-q.results
if ok {
emitQueue = append(emitQueue, &queryEvent{Event: evt, query: q.i})
select {
case evt, ok := <-q.results:
if ok {
emitQueue = append(emitQueue, &queryEvent{Event: evt, query: q.i})
}
case <-ctx.Done():
return
}
}

Expand Down

0 comments on commit 1f67814

Please sign in to comment.