Skip to content

Commit

Permalink
Fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushinDaniil committed Jan 8, 2025
1 parent 2653ae9 commit 7594251
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"log"
"maps"
"math"
"strings"
stdsync "sync"
Expand Down Expand Up @@ -194,9 +195,15 @@ func (h *Handler) Run(ctx context.Context) error {
feed.Tee(l1HeadsSub, h.l1Heads)

<-ctx.Done()
for _, sub := range h.subscriptions {

h.mu.Lock()
subscriptions := maps.Values(h.subscriptions)
h.mu.Unlock()

for sub := range subscriptions {
sub.wg.Wait()
}

return nil
}

Expand Down

0 comments on commit 7594251

Please sign in to comment.