mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16: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)
|
||||
}
|
||||
// Wait for downloader to finish processing with a timeout
|
||||
for t0 := time.Now(); time.Since(t0) < 10*time.Second; time.Sleep(100 * time.Millisecond) {
|
||||
if !empty.handler.snapSync.Load() {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if empty.handler.snapSync.Load() {
|
||||
for timeout := time.After(5 * time.Second); ; {
|
||||
select {
|
||||
case <-timeout:
|
||||
t.Fatalf("snap sync not disabled after successful synchronisation")
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
if !empty.handler.snapSync.Load() {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue