Skip to content

Commit

Permalink
primitive support for CLOSED in SimplePool.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Dec 1, 2023
1 parent 775821f commit 711db06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nostr
import (
"context"
"fmt"
"log"
"sync"
"time"

Expand Down Expand Up @@ -116,6 +117,9 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
}
}
case events <- IncomingEvent{Event: evt, Relay: relay}:
case reason := <-sub.ClosedReason:
log.Printf("CLOSED from %s: '%s'\n", nm, reason)
return
case <-ctx.Done():
return
}
Expand Down Expand Up @@ -177,6 +181,9 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
return
case <-sub.EndOfStoredEvents:
return
case reason := <-sub.ClosedReason:
log.Printf("CLOSED from %s: '%s'\n", nm, reason)
return
case evt, more := <-sub.Events:
if !more {
return
Expand Down

0 comments on commit 711db06

Please sign in to comment.