You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/11/25 23:17:43 UTC

[GitHub] [pulsar] jerrypeng commented on a change in pull request #8687: Add timeout to hasMessageAvailable to leader election process in Pulsar Functions

jerrypeng commented on a change in pull request #8687:
URL: https://github.com/apache/pulsar/pull/8687#discussion_r530689243



##########
File path: pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionAssignmentTailer.java
##########
@@ -145,7 +145,7 @@ private Thread getTailerThread() {
                 try {
                     Message<byte[]> msg = reader.readNext(1, TimeUnit.SECONDS);
                     if (msg == null) {
-                        if (exitOnEndOfTopic && !reader.hasMessageAvailable()) {
+                        if (exitOnEndOfTopic && !reader.hasMessageAvailableAsync().get(10, TimeUnit.SECONDS)) {

Review comment:
       When the timeout expires, a TimeoutException will be thrown and which will force the worker to shutdown and restart.  Another worker can more process to becoming leader.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org