refactor(Worker): shutdown when shardInfoShardConsumerMap is empty

This commit is contained in:
glarwood 2019-03-05 20:34:58 -08:00
parent 6fd2276556
commit 14fb8e2703

View file

@ -482,9 +482,10 @@ public class Worker implements Runnable {
shutdown();
}
while (!shouldShutdown()) {
do {
// use do while to initialize the shardInfoShardConsumerMap, which is checked in shouldShutdown()
runProcessLoop();
}
} while (!shouldShutdown());
finalShutdown();
LOG.info("Worker loop is complete. Exiting from worker.");
@ -526,6 +527,9 @@ public class Worker implements Runnable {
LOG.info("Worker: sleep interrupted after catching exception ", ex);
}
}
// reset retries
retries.set(0);
wlog.resetInfoLogging();
}
@ -868,6 +872,10 @@ public class Worker implements Runnable {
return true;
}
}
if (shardInfoShardConsumerMap.isEmpty()) {
LOG.info("Nothing to consume");
}
return false;
}