Skip to content

Commit

Permalink
More logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nobl9-adam-szymanski committed Aug 5, 2023
1 parent 0802328 commit 6264f2d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions partition_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,19 +445,51 @@ func (p *PartitionTable) loadMessages(ctx context.Context, cons sarama.Partition
select {
case err, ok := <-errors:
if !ok {
p.log.Debugf(
"load messages exit with err !ok = topic=%s, partition=%v, key=%s, offset=%v, timestamp=%v",
msg.Topic,
msg.Partition,
string(msg.Key),
msg.Offset,
msg.Timestamp,
)
return nil
}
if err != nil {
p.log.Debugf(
"load messages exit with err = topic=%s, partition=%v, key=%s, offset=%v, timestamp=%v",
msg.Topic,
msg.Partition,
string(msg.Key),
msg.Offset,
msg.Timestamp,
)
return err
}
case msg, ok := <-messages:
if !ok {
p.log.Debugf(
"load messages exit with msg !ok = topic=%s, partition=%v, key=%s, offset=%v, timestamp=%v",
msg.Topic,
msg.Partition,
string(msg.Key),
msg.Offset,
msg.Timestamp,
)
return nil
}

// This case is for the Tester to achieve synchronity.
// Nil messages are never generated by the Sarama Consumer
if msg == nil {
p.log.Debugf(
"load messages continue msg == nil = topic=%s, partition=%v, key=%s, offset=%v, timestamp=%v",
msg.Topic,
msg.Partition,
string(msg.Key),
msg.Offset,
msg.Timestamp,
)
continue
}

Expand Down

0 comments on commit 6264f2d

Please sign in to comment.