mirror of https://github.com/status-im/op-geth.git
eth/downloader: fix throttling test to be less timing dependent
This commit is contained in:
parent
2d627995cf
commit
4b2dd44711
|
@ -273,9 +273,13 @@ func TestThrottling(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
// Iteratively take some blocks, always checking the retrieval count
|
// Iteratively take some blocks, always checking the retrieval count
|
||||||
for total := 0; total < targetBlocks; {
|
for total := 0; total < targetBlocks; {
|
||||||
// Sleep a bit for sync to complete
|
// Wait a bit for sync to complete
|
||||||
time.Sleep(500 * time.Millisecond)
|
for start := time.Now(); time.Since(start) < 3*time.Second; {
|
||||||
|
time.Sleep(25 * time.Millisecond)
|
||||||
|
if len(tester.downloader.queue.blockPool) == blockCacheLimit {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
// Fetch the next batch of blocks
|
// Fetch the next batch of blocks
|
||||||
took := tester.downloader.TakeBlocks()
|
took := tester.downloader.TakeBlocks()
|
||||||
if len(took) != blockCacheLimit {
|
if len(took) != blockCacheLimit {
|
||||||
|
|
Loading…
Reference in New Issue