Skip to content

Commit

Permalink
Have Jetty shutdown last after all Guava managed services by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kevink-sq committed Aug 6, 2024
1 parent 0840104 commit a99cd64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions misk/src/main/kotlin/misk/web/actions/LivenessCheckAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class LivenessCheckAction @Inject internal constructor(
@AvailableWhenDegraded
fun livenessCheck(): Response<String> {
val serviceManager = serviceManagerProvider.get()
val failedServices = serviceManager.servicesByState().get(State.FAILED) +
serviceManager.servicesByState().get(State.TERMINATED)
val failedServices = serviceManager.servicesByState().get(State.FAILED)

if (failedServices.isEmpty()) {
return Response("", statusCode = 200)
Expand Down
4 changes: 3 additions & 1 deletion misk/src/main/kotlin/misk/web/jetty/JettyService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ class JettyService @Inject internal constructor(
//
// Ideally we could call jetty.awaitInflightRequests() but that's not available
// for us.
if (webConfig.shutdown_sleep_ms > 0) {
//
// Default behavior is to allow jetty to be shutdown after all guava managed services.
if (webConfig.shutdown_sleep_ms >= 0) {
sleep(webConfig.shutdown_sleep_ms.toLong())
} else {
stop()
Expand Down

0 comments on commit a99cd64

Please sign in to comment.