Skip to content

Commit

Permalink
chore: skip publishing the last empty struct when generator stops (nu…
Browse files Browse the repository at this point in the history
  • Loading branch information
KeranYang authored and SaniyaKalamkar committed Jan 19, 2025
1 parent 1296b5b commit 76a46ac
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 76a46ac

Please sign in to comment.