This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 108c525  Fix the logic of checking of variables (#3979)
108c525 is described below

commit 108c525510239d21d4d618f8e16d87910fdccce7
Author: Sanjeev Kulkarni <[email protected]>
AuthorDate: Thu Apr 4 09:10:09 2019 -0700

    Fix the logic of checking of variables (#3979)
---
 .../org/apache/pulsar/functions/runtime/KubernetesRuntime.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
 
b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
index 103980f..3d11858 100644
--- 
a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
+++ 
b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
@@ -284,16 +284,14 @@ public class KubernetesRuntime implements Runtime {
     @Override
     public CompletableFuture<FunctionStatus> getFunctionStatus(int instanceId) 
{
         CompletableFuture<FunctionStatus> retval = new CompletableFuture<>();
-        if (instanceId < 0 || instanceId >= stub.length) {
-            if (stub == null) {
-                retval.completeExceptionally(new RuntimeException("Invalid 
InstanceId"));
-                return retval;
-            }
-        }
         if (stub == null) {
             retval.completeExceptionally(new RuntimeException("Not alive"));
             return retval;
         }
+        if (instanceId < 0 || instanceId >= stub.length) {
+            retval.completeExceptionally(new RuntimeException("Invalid 
InstanceId"));
+            return retval;
+        }
         ListenableFuture<FunctionStatus> response = 
stub[instanceId].withDeadlineAfter(GRPC_TIMEOUT_SECS, 
TimeUnit.SECONDS).getFunctionStatus(Empty.newBuilder().build());
         Futures.addCallback(response, new FutureCallback<FunctionStatus>() {
             @Override

Reply via email to