Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ds4_server: Add /health endpoint that returns HTTP 200 once model is fully loaded #374

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

Open
mcmalayalam wants to merge 1 commit into antirez:main
base: main
Choose a base branch
Loading
from mcmalayalam:health-endpoint
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ds4_server.c
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7708,6 +7708,7 @@ struct server {
visible_live_state thinking_live;
bool disable_exact_dsml_tool_replay;
bool enable_cors;
volatile bool model_ready;
pthread_mutex_t tool_mu;
pthread_mutex_t mu;
pthread_cond_t cv;
Expand Down Expand Up @@ -11147,6 +11148,16 @@ static void *client_main(void *arg) {
goto done;
}

if (!strcmp(hr.method, "GET") && !strcmp(hr.path, "/health")) {
if (s->model_ready) {
http_response(fd, s->enable_cors, 200, "text/plain", "ok");
} else {
http_error(fd, s->enable_cors, 503, "model not yet loaded");
}
http_request_free(&hr);
goto done;
}

if (!strcmp(hr.method, "GET") && !strcmp(hr.path, "/v1/models")) {
send_models(s, fd);
http_request_free(&hr);
Expand Down Expand Up @@ -11625,6 +11636,7 @@ int main(int argc, char **argv) {
s.disable_exact_dsml_tool_replay = cfg.disable_exact_dsml_tool_replay;
s.tool_mem.max_entries = cfg.tool_memory_max_ids;
s.enable_cors = cfg.enable_cors;
s.model_ready = true;
if (cfg.kv_disk_dir) {
kv_cache_open(&s.kv, cfg.kv_disk_dir, cfg.kv_disk_space_mb,
cfg.kv_cache_reject_different_quant, cfg.kv_cache);
Expand Down

AltStyle によって変換されたページ (->オリジナル) /