mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
save
This commit is contained in:
parent
3b66aa0571
commit
94770020ec
@ -316,6 +316,15 @@ func (q *ResultsQueueIter) PopNext() *TxTask {
|
||||
}
|
||||
|
||||
func (q *ResultsQueue) Drain(ctx context.Context) error {
|
||||
q.Lock()
|
||||
l := q.results.Len()
|
||||
q.Unlock()
|
||||
// if queue is empty, then need block to wait new results
|
||||
if l > 0 {
|
||||
q.drainNoBlock(nil)
|
||||
return nil
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
|
Loading…
Reference in New Issue
Block a user