Skip to content

Commit

Permalink
fix: break from loop when context cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Sep 19, 2023
1 parent a25cd9b commit eab31ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/aggregateeventrecorder/aggregateeventrecorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (a *aggregateEventRecorder) ingestEvents() {
for {
select {
case <-a.ctx.Done():
return

// Read incoming data
case event := <-a.ingestChan:
Expand Down Expand Up @@ -297,6 +298,7 @@ func (a *aggregateEventRecorder) postEvents() {
select {
case <-a.ctx.Done():
return

case batchedData := <-a.postChan:
byts, err := json.Marshal(batchedEvents{batchedData})
if err != nil {
Expand Down

0 comments on commit eab31ac

Please sign in to comment.