From 0ea7fd95f395fc956c5ee4b03d4c0c7e06edea68 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 7 Feb 2025 18:02:19 -0300 Subject: [PATCH] QuerySingle() to take opts. --- pool.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pool.go b/pool.go index 5a3ff3f..983c329 100644 --- a/pool.go +++ b/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 }