Skip to content

Commit

Permalink
eth/downloader: fix race condition in tests (#22140)
Browse files Browse the repository at this point in the history
* downloader: fix race condition in tests

* eth/downloader: fix race condition in tests

* Revert "downloader: fix race condition in tests"

This reverts commit 108033ebc6985de83791d375b6e6647a77d28d5a.
  • Loading branch information
ziogaschr authored Jan 9, 2021
1 parent 889f564 commit 89030ec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions eth/downloader/downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,15 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) {
time.Sleep(25 * time.Millisecond)

tester.lock.Lock()
tester.downloader.queue.lock.Lock()
tester.downloader.queue.resultCache.lock.Lock()
{
tester.downloader.queue.resultCache.lock.Lock()
cached = tester.downloader.queue.resultCache.countCompleted()
tester.downloader.queue.resultCache.lock.Unlock()
frozen = int(atomic.LoadUint32(&blocked))
retrieved = len(tester.ownBlocks)

}
tester.downloader.queue.resultCache.lock.Unlock()
tester.downloader.queue.lock.Unlock()
tester.lock.Unlock()

if cached == blockCacheMaxItems ||
Expand Down

0 comments on commit 89030ec

Please sign in to comment.