Skip to content

Commit

Permalink
remove unnecessary mutex.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Dec 15, 2023
1 parent f60b70e commit 2f514d5
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
seenAlready := xsync.NewMapOf[Timestamp]()
ticker := time.NewTicker(seenAlreadyDropTick)

var mu sync.Mutex
eose := false

pending := xsync.NewCounter()
Expand Down Expand Up @@ -143,9 +142,7 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt

go func() {
<-sub.EndOfStoredEvents
mu.Lock()
eose = true
mu.Unlock()
}()

// reset interval when we get a good subscription
Expand Down Expand Up @@ -174,7 +171,6 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
case <-ctx.Done():
}
case <-ticker.C:
mu.Lock()
if eose {
old := Timestamp(time.Now().Add(-seenAlreadyDropTick).Unix())
seenAlready.Range(func(id string, value Timestamp) bool {
Expand All @@ -184,7 +180,6 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
return true
})
}
mu.Unlock()
case reason := <-sub.ClosedReason:
if strings.HasPrefix(reason, "auth-required:") && pool.authHandler != nil && !hasAuthed {
// relay is requesting auth. if we can we will perform auth and try again
Expand Down

0 comments on commit 2f514d5

Please sign in to comment.