Skip to content

Commit 9e35085

Browse files
Dream95lhotari
authored andcommitted
[improve][fn] Avoid gRPC timeout when getting status of a dead process runtime (#25819)
Signed-off-by: Dream95 <zhou_8621@163.com> (cherry picked from commit 5fd7518)
1 parent f9b8ac4 commit 9e35085

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/process

pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/process/ProcessRuntime.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,15 @@ public CompletableFuture<FunctionStatus> getFunctionStatus(int instanceId) {
242242
retval.completeExceptionally(new RuntimeException("Not alive"));
243243
return retval;
244244
}
245+
if (!isAlive()) {
246+
FunctionStatus.Builder builder = FunctionStatus.newBuilder();
247+
builder.setRunning(false);
248+
if (deathException != null && deathException.getMessage() != null) {
249+
builder.setFailureException(deathException.getMessage());
250+
}
251+
retval.complete(builder.build());
252+
return retval;
253+
}
245254
ListenableFuture<FunctionStatus> response = stub.withDeadlineAfter(GRPC_TIMEOUT_SECS, TimeUnit.SECONDS)
246255
.getFunctionStatus(Empty.newBuilder().build());
247256
Futures.addCallback(response, new FutureCallback<FunctionStatus>() {

0 commit comments

Comments
 (0)