aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-07 23:46:32 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-08 18:23:58 +0800
commit4b2dd44711a04c639ecde68806455ccf7244acce (patch)
tree7ffc67ecb34c690eef9587fcc776b0fc5d198f2a
parent2d627995cf22b9a1187e4b22d430f84541904d2c (diff)
downloaddexon-4b2dd44711a04c639ecde68806455ccf7244acce.tar
dexon-4b2dd44711a04c639ecde68806455ccf7244acce.tar.gz
dexon-4b2dd44711a04c639ecde68806455ccf7244acce.tar.bz2
dexon-4b2dd44711a04c639ecde68806455ccf7244acce.tar.lz
dexon-4b2dd44711a04c639ecde68806455ccf7244acce.tar.xz
dexon-4b2dd44711a04c639ecde68806455ccf7244acce.tar.zst
dexon-4b2dd44711a04c639ecde68806455ccf7244acce.zip
eth/downloader: fix throttling test to be less timing dependent
-rw-r--r--eth/downloader/downloader_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index 4e2d527b9..4219c2788 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -273,9 +273,13 @@ func TestThrottling(t *testing.T) {
}()
// Iteratively take some blocks, always checking the retrieval count
for total := 0; total < targetBlocks; {
- // Sleep a bit for sync to complete
- time.Sleep(500 * time.Millisecond)
-
+ // Wait a bit for sync to complete
+ 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
took := tester.downloader.TakeBlocks()
if len(took) != blockCacheLimit {