mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-11 09:20:51 +02:00
pool.QuerySingle()
This commit is contained in:
parent
b522d24c30
commit
5a51f84433
10
pool.go
10
pool.go
@ -145,3 +145,13 @@ func (pool *SimplePool) SubManyEose(ctx context.Context, urls []string, filters
|
||||
|
||||
return uniqueEvents
|
||||
}
|
||||
|
||||
// QuerySingle returns the first event returned by the first relay, cancels everything else.
|
||||
func (pool *SimplePool) QuerySingle(ctx context.Context, urls []string, filter Filter) *Event {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
for evt := range pool.SubManyEose(ctx, urls, Filters{filter}) {
|
||||
return evt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user