mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
core: fix potential race in chainIndexerTest (#22346)
This commit is contained in:
parent
5bc0343ed3
commit
c454717fa6
@ -18,6 +18,7 @@ package core
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -224,7 +225,10 @@ func (b *testChainIndexBackend) Process(ctx context.Context, header *types.Heade
|
|||||||
//t.processCh <- header.Number.Uint64()
|
//t.processCh <- header.Number.Uint64()
|
||||||
select {
|
select {
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(10 * time.Second):
|
||||||
b.t.Fatal("Unexpected call to Process")
|
b.t.Error("Unexpected call to Process")
|
||||||
|
// Can't use Fatal since this is not the test's goroutine.
|
||||||
|
// Returning error stops the chainIndexer's updateLoop
|
||||||
|
return errors.New("Unexpected call to Process")
|
||||||
case b.processCh <- header.Number.Uint64():
|
case b.processCh <- header.Number.Uint64():
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user