Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanbergen committed Apr 9, 2015
1 parent f742bce commit 300b948
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ func (client *client) Coordinator(consumerGroup string) (*Broker, error) {
return nil, err
}

Logger.Printf("client/coordinator Caching #%d (%s) as coordinator for consumergoup %s.\n", coordinator.ID(), coordinator.Addr(), consumerGroup)

client.coordinatorLock.Lock()
client.coordinators[consumerGroup] = coordinator
client.coordinatorLock.Unlock()
Expand Down Expand Up @@ -631,14 +629,15 @@ func (client *client) updateMetadata(data *MetadataResponse) ([]string, error) {
func (client *client) refreshCoordinator(consumerGroup string, attemptsRemaining int) (*Broker, error) {
for broker := client.any(); broker != nil; broker = client.any() {

Logger.Printf("client/coordinator Finding coordinator for consumergoup %s fom %s.\n", consumerGroup, broker.Addr())
Logger.Printf("client/coordinator Requesting coordinator for consumergoup %s from %s.\n", consumerGroup, broker.Addr())

request := new(ConsumerMetadataRequest)
request.ConsumerGroup = consumerGroup

response, err := broker.GetConsumerMetadata(request)

if err != nil {
Logger.Printf("client/coordinator Request to broker %s failed: %s.\n", broker.Addr(), err)
_ = broker.Close()
client.disconnectBroker(broker)
continue
Expand Down Expand Up @@ -666,7 +665,7 @@ func (client *client) refreshCoordinator(consumerGroup string, attemptsRemaining
return coordinator, nil

case ErrConsumerCoordinatorNotAvailable:
Logger.Printf("client/coordinator Coordinator for consumer group %s not yet available, trying again in 1s...\n", consumerGroup, attemptsRemaining)
Logger.Printf("client/coordinator Coordinator for consumer group %s not yet available, trying again in %dms...\n", consumerGroup, client.conf.Metadata.Retry.Backoff/time.Millisecond)
time.Sleep(client.conf.Metadata.Retry.Backoff)
continue

Expand Down

0 comments on commit 300b948

Please sign in to comment.