-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][fn] Add API endpoint for function-worker for liveness check with configurable flag #358
base: 3.1_ds
Are you sure you want to change the base?
Changes from 4 commits
87c9f28
d0a2208
2c03bc9
eef9187
ecaea1a
3e75277
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.core.StreamingOutput; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.pulsar.common.functions.FunctionConfig; | ||
|
@@ -429,4 +430,18 @@ public void updateFunctionOnWorkerLeader(final @PathParam("tenant") String tenan | |
functions().updateFunctionOnWorkerLeader(tenant, namespace, functionName, uploadedInputStream, | ||
delete, uri.getRequestUri(), authParams()); | ||
} | ||
|
||
@GET | ||
@Path("/live") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The API has been updated to include a |
||
public Response checkLiveliness() { | ||
boolean isAlive = functions().checkLiveliness(); | ||
if (!isAlive) { | ||
return Response.status(Response.Status.SERVICE_UNAVAILABLE) | ||
.entity("There is IllegalStateException, Service is not running. Need to restart.") | ||
.build(); | ||
} else { | ||
return Response.ok("There is no IllegalStateException, Service is running.") | ||
.build(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here if we get an
IllegalStateException
which is not aProducerFencedException
? Maybe it would be better to catch the specific exception type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The block of code has been moved to a location where we can check if the cause is a
ProducerFencedException
.