mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
QuerySingle() to take opts.
This commit is contained in:
parent
f19efb4013
commit
0ea7fd95f3
9
pool.go
9
pool.go
@ -575,9 +575,14 @@ func (pool *SimplePool) CountMany(
|
||||
}
|
||||
|
||||
// QuerySingle returns the first event returned by the first relay, cancels everything else.
|
||||
func (pool *SimplePool) QuerySingle(ctx context.Context, urls []string, filter Filter) *RelayEvent {
|
||||
func (pool *SimplePool) QuerySingle(
|
||||
ctx context.Context,
|
||||
urls []string,
|
||||
filter Filter,
|
||||
opts ...SubscriptionOption,
|
||||
) *RelayEvent {
|
||||
ctx, cancel := context.WithCancelCause(ctx)
|
||||
for ievt := range pool.SubManyEose(ctx, urls, Filters{filter}) {
|
||||
for ievt := range pool.SubManyEose(ctx, urls, Filters{filter}, opts...) {
|
||||
cancel(errors.New("got the first event and ended successfully"))
|
||||
return &ievt
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user