Skip to content

Commit

Permalink
Merge pull request #18 from mattn/set-nil
Browse files Browse the repository at this point in the history
set nil to ch
  • Loading branch information
mattn authored May 23, 2024
2 parents 0120ec1 + ee54d25 commit a5d0bdf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opensearch/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (oss *OpensearchStorage) QueryEvents(ctx context.Context, filter nostr.Filt
ch <- evt
}
close(ch)
ch = nil
} else {
return nil, fmt.Errorf("error getting by id: %w", err)
}
Expand Down Expand Up @@ -152,7 +153,9 @@ func (oss *OpensearchStorage) QueryEvents(ctx context.Context, filter nostr.Filt
}
}
}
close(ch)
if ch != nil {
close(ch)
}
}()

return ch, nil
Expand Down

0 comments on commit a5d0bdf

Please sign in to comment.