mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-10-09 20:33:27 +02:00
after getting an EOSE we should stop checking since/until.
This commit is contained in:
@@ -32,6 +32,7 @@ type Subscription struct {
|
||||
// Context will be .Done() when the subscription ends
|
||||
Context context.Context
|
||||
|
||||
match func(*Event) bool // this will be either Filters.Match or Filters.MatchIgnoringTimestampConstraints
|
||||
live atomic.Bool
|
||||
eosed atomic.Bool
|
||||
closed atomic.Bool
|
||||
@@ -104,6 +105,7 @@ func (sub *Subscription) dispatchEvent(evt *Event) {
|
||||
|
||||
func (sub *Subscription) dispatchEose() {
|
||||
if sub.eosed.CompareAndSwap(false, true) {
|
||||
sub.match = sub.Filters.MatchIgnoringTimestampConstraints
|
||||
go func() {
|
||||
sub.storedwg.Wait()
|
||||
sub.EndOfStoredEvents <- struct{}{}
|
||||
|
Reference in New Issue
Block a user