Skip to content

Commit

Permalink
Check for closed channel
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuswilms committed Feb 13, 2025
1 parent 295063e commit c9576cd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/ctrlq/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ func (wq *MemoryVisitWorkQueue) Consume(ctx context.Context) (<-chan *VisitJob,
case msg := <-wq.dqueue:
// slog.Debug("Work Queue: Received message, forwarding to results channel.", "msg.id", p.Message.ID)

if msg == nil {
slog.Debug("Work Queue: Detected closed channel, closing channels.")

close(reschan)
close(errchan)
return
}

// Initializes the context for the job. Than extract the tracing
// information from the carrier into the job's context.
jctx := context.Background()
Expand Down

0 comments on commit c9576cd

Please sign in to comment.