Skip to content

Commit

Permalink
corrected Queue.Enqueue non determinism
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumemichel committed May 24, 2023
1 parent 04cf63e commit 08e0680
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions provider/internal/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func (q *Queue) Close() error {

// Enqueue puts a cid in the queue
func (q *Queue) Enqueue(cid cid.Cid) error {
select {
case <-q.ctx.Done():
return fmt.Errorf("failed to enqueue CID: shutting down")
default:
}

select {
case q.enqueue <- cid:
return nil
Expand Down

0 comments on commit 08e0680

Please sign in to comment.