Skip to content

Commit

Permalink
Fix possible concurrent map write in test
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Dec 22, 2023
1 parent fe44e6c commit 208037b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dagsync/subscriber_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,11 @@ func TestMaxAsyncSyncs(t *testing.T) {
dstHost := test.MkTestHost(t)
dstLnkS, blocked := test.MkBlockedLinkSystem(dstStore)
blocksSeenByHook := make(map[cid.Cid]struct{})
bhMutex := new(sync.Mutex)
blockHook := func(p peer.ID, c cid.Cid, _ dagsync.SegmentSyncActions) {
bhMutex.Lock()
blocksSeenByHook[c] = struct{}{}
bhMutex.Unlock()
}

sub, err := dagsync.NewSubscriber(dstHost, dstStore, dstLnkS, testTopic,
Expand Down

0 comments on commit 208037b

Please sign in to comment.