diff options
| author | 2024-01-10 09:16:40 +0100 | |
|---|---|---|
| committer | 2024-01-10 09:16:40 +0100 | |
| commit | 06302c64519573cef6ff832c3edb49f23794638c (patch) | |
| tree | bd4b80b5c5814e5422b8df04f9f63d393c2f25aa | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-06302c64519573cef6ff832c3edb49f23794638c.tar.gz snac2-06302c64519573cef6ff832c3edb49f23794638c.tar.xz snac2-06302c64519573cef6ff832c3edb49f23794638c.zip | |
Minor code cleaning.
| -rw-r--r-- | httpd.c | 14 | ||||
| -rw-r--r-- | snac.h | 2 |
2 files changed, 3 insertions, 13 deletions
| @@ -235,16 +235,6 @@ int server_get_handler(xs_dict *req, const char *q_path, | |||
| 235 | *body = xs_str_new("User-agent: *\n" | 235 | *body = xs_str_new("User-agent: *\n" |
| 236 | "Disallow: /\n"); | 236 | "Disallow: /\n"); |
| 237 | } | 237 | } |
| 238 | else | ||
| 239 | if (strcmp(q_path, "/status.txt") == 0) { | ||
| 240 | status = 200; | ||
| 241 | *ctype = "text/plain"; | ||
| 242 | *body = xs_str_new("UP\n"); | ||
| 243 | |||
| 244 | xs *uptime = xs_str_time_diff(time(NULL) - p_state->srv_start_time); | ||
| 245 | srv_log(xs_fmt("status: uptime: %s", uptime)); | ||
| 246 | srv_log(xs_fmt("status: job_fifo len: %d", p_state->job_fifo_size)); | ||
| 247 | } | ||
| 248 | 238 | ||
| 249 | if (status != 0) | 239 | if (status != 0) |
| 250 | srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status)); | 240 | srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status)); |
| @@ -457,8 +447,8 @@ void job_post(const xs_val *job, int urgent) | |||
| 457 | 447 | ||
| 458 | p_state->job_fifo_size++; | 448 | p_state->job_fifo_size++; |
| 459 | 449 | ||
| 460 | if (p_state->job_fifo_size > p_state->top_job_fifo_size) | 450 | if (p_state->job_fifo_size > p_state->peak_job_fifo_size) |
| 461 | p_state->top_job_fifo_size = p_state->job_fifo_size; | 451 | p_state->peak_job_fifo_size = p_state->job_fifo_size; |
| 462 | 452 | ||
| 463 | /* unlock the mutex */ | 453 | /* unlock the mutex */ |
| 464 | pthread_mutex_unlock(&job_mutex); | 454 | pthread_mutex_unlock(&job_mutex); |
| @@ -50,7 +50,7 @@ typedef struct { | |||
| 50 | int use_fcgi; /* FastCGI use on/off */ | 50 | int use_fcgi; /* FastCGI use on/off */ |
| 51 | time_t srv_start_time; /* start time */ | 51 | time_t srv_start_time; /* start time */ |
| 52 | int job_fifo_size; /* job fifo size */ | 52 | int job_fifo_size; /* job fifo size */ |
| 53 | int top_job_fifo_size; /* maximum job fifo size seen */ | 53 | int peak_job_fifo_size; /* maximum job fifo size seen */ |
| 54 | int n_threads; /* number of configured threads */ | 54 | int n_threads; /* number of configured threads */ |
| 55 | enum { THST_WAIT, THST_IN, THST_QUEUE, THST_STOP } th_state[MAX_THREADS]; | 55 | enum { THST_WAIT, THST_IN, THST_QUEUE, THST_STOP } th_state[MAX_THREADS]; |
| 56 | } srv_state; | 56 | } srv_state; |