-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a91f5c2
commit cebce99
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
wren-main/src/main/java/io/wren/main/web/SystemResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.wren.main.web; | ||
|
||
import com.google.inject.Inject; | ||
import io.wren.main.PreviewService; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.container.AsyncResponse; | ||
import jakarta.ws.rs.container.Suspended; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
@Path("/v2") | ||
public class SystemResource | ||
{ | ||
private final PreviewService previewService; | ||
|
||
@Inject | ||
public SystemResource(PreviewService previewService) | ||
{ | ||
this.previewService = previewService; | ||
} | ||
|
||
@GET | ||
@Path("/health") | ||
public void health(@Suspended AsyncResponse asyncResponse) | ||
{ | ||
if (previewService.isWarmed()) { | ||
asyncResponse.resume(Response.ok().build()); | ||
} | ||
else { | ||
asyncResponse.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).build()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters