mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
another ctx done case
This commit is contained in:
parent
4792f0a3ba
commit
0cae00b09c
1 changed files with 4 additions and 0 deletions
|
|
@ -312,10 +312,14 @@ func (indexer *txIndexer) txIndexProgress(ctx context.Context) (TxIndexProgress,
|
||||||
case prog := <-ch:
|
case prog := <-ch:
|
||||||
return prog, nil
|
return prog, nil
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
// Since the channel is buffered the loop will not block
|
||||||
|
// eventually when it prepares the response.
|
||||||
return TxIndexProgress{}, ctx.Err()
|
return TxIndexProgress{}, ctx.Err()
|
||||||
}
|
}
|
||||||
case <-indexer.closed:
|
case <-indexer.closed:
|
||||||
return TxIndexProgress{}, errors.New("indexer is closed")
|
return TxIndexProgress{}, errors.New("indexer is closed")
|
||||||
|
case <-ctx.Done():
|
||||||
|
return TxIndexProgress{}, ctx.Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue