Skip to content

Commit

Permalink
Add timeout to hasMessageAvailable to leader election process in Puls…
Browse files Browse the repository at this point in the history
…ar Functions (apache#8687)

Co-authored-by: Jerry Peng <[email protected]>
  • Loading branch information
jerrypeng and Jerry Peng authored Nov 27, 2020
1 parent ea5882a commit 9443ba2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
break;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void run() {
try {
Message<byte[]> msg = reader.readNext(1, TimeUnit.SECONDS);
if (msg == null) {
if (exitOnEndOfTopic && !reader.hasMessageAvailable()) {
if (exitOnEndOfTopic && !reader.hasMessageAvailableAsync().get(10, TimeUnit.SECONDS)) {
break;
}
} else {
Expand Down

0 comments on commit 9443ba2

Please sign in to comment.