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/07/12 17:13:30 UTC

[GitHub] [pulsar] jerrypeng commented on a change in pull request #7509: Fix: Race condition in updateFunctionOnLeader

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



##########
File path: pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java
##########
@@ -686,10 +686,33 @@ public void updateFunctionOnWorkerLeader(final String tenant,
         }
 
         // Redirect if we are not the leader
+        boolean shouldRedirect = false;
         if (!worker().getLeaderService().isLeader()) {
             WorkerInfo workerInfo = worker().getMembershipManager().getLeader();
-            URI redirect = UriBuilder.fromUri(uri).host(workerInfo.getWorkerHostname()).port(workerInfo.getPort()).build();
-            throw new WebApplicationException(Response.temporaryRedirect(redirect).build());
+            // there might be a delay between when the leader service for this worker gets triggered "becomeActive"

Review comment:
       I would rather minimize the number of errors we return to the user




----------------------------------------------------------------
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