From 8f0d7bc8d85d0572f937fb2d1c218063e7ae1e88 Mon Sep 17 00:00:00 2001 From: Kevin Burns Date: Wed, 22 Jan 2020 03:26:22 -0800 Subject: [PATCH] Reduce log noise from found shards in worker event loop (#66) Signed-off-by: Kev Burns --- clientlibrary/worker/worker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clientlibrary/worker/worker.go b/clientlibrary/worker/worker.go index 95c1acd..e7efa66 100644 --- a/clientlibrary/worker/worker.go +++ b/clientlibrary/worker/worker.go @@ -238,6 +238,7 @@ func (w *Worker) newShardConsumer(shard *par.ShardStatus) *ShardConsumer { func (w *Worker) eventLoop() { log := w.kclConfig.Logger + var foundShards int for { // Add [-50%, +50%] random jitter to ShardSyncIntervalMillis. When multiple workers // starts at the same time, this decreases the probability of them calling @@ -252,7 +253,10 @@ func (w *Worker) eventLoop() { continue } - log.Infof("Found %d shards", len(w.shardStatus)) + if foundShards == 0 || foundShards != len(w.shardStatus) { + foundShards = len(w.shardStatus) + log.Infof("Found %d shards", foundShards) + } // Count the number of leases hold by this worker excluding the processed shard counter := 0