mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
eth: use loop+select polling to speed up test
This commit is contained in:
parent
1c57917465
commit
8574028a97
1 changed files with 8 additions and 7 deletions
|
|
@ -89,13 +89,14 @@ func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) {
|
||||||
t.Fatal("sync failed:", err)
|
t.Fatal("sync failed:", err)
|
||||||
}
|
}
|
||||||
// Wait for downloader to finish processing with a timeout
|
// Wait for downloader to finish processing with a timeout
|
||||||
for t0 := time.Now(); time.Since(t0) < 10*time.Second; time.Sleep(100 * time.Millisecond) {
|
for timeout := time.After(5 * time.Second); ; {
|
||||||
if !empty.handler.snapSync.Load() {
|
select {
|
||||||
break
|
case <-timeout:
|
||||||
|
t.Fatalf("snap sync not disabled after successful synchronisation")
|
||||||
|
case <-time.After(100 * time.Millisecond):
|
||||||
|
if !empty.handler.snapSync.Load() {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if empty.handler.snapSync.Load() {
|
|
||||||
t.Fatalf("snap sync not disabled after successful synchronisation")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue