Skip to content

Commit

Permalink
chore: skip publishing the last empty struct when generator stops (#2327
Browse files Browse the repository at this point in the history
)
  • Loading branch information
KeranYang authored Jan 13, 2025
1 parent ade70d8 commit 2922173
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/sources/generator/tickgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ loop:
// since the Read call is blocking, and runs in an infinite loop,
// we implement Read With Wait semantics
select {
case r := <-mg.srcChan:
case r, ok := <-mg.srcChan:
if !ok {
mg.logger.Info("All the messages have been read. returning.")
break loop
}
msgs = append(msgs, mg.newReadMessage(r.key, r.data, r.offset, r.ts))
case <-timeout:
break loop
Expand Down

0 comments on commit 2922173

Please sign in to comment.