Minor code cleaning.

This commit is contained in:
default 2024-01-10 09:16:40 +01:00
parent 472ade7b4a
commit 06302c6451
2 changed files with 3 additions and 13 deletions

14
httpd.c
View file

@ -235,16 +235,6 @@ int server_get_handler(xs_dict *req, const char *q_path,
*body = xs_str_new("User-agent: *\n" *body = xs_str_new("User-agent: *\n"
"Disallow: /\n"); "Disallow: /\n");
} }
else
if (strcmp(q_path, "/status.txt") == 0) {
status = 200;
*ctype = "text/plain";
*body = xs_str_new("UP\n");
xs *uptime = xs_str_time_diff(time(NULL) - p_state->srv_start_time);
srv_log(xs_fmt("status: uptime: %s", uptime));
srv_log(xs_fmt("status: job_fifo len: %d", p_state->job_fifo_size));
}
if (status != 0) if (status != 0)
srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status)); 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)
p_state->job_fifo_size++; p_state->job_fifo_size++;
if (p_state->job_fifo_size > p_state->top_job_fifo_size) if (p_state->job_fifo_size > p_state->peak_job_fifo_size)
p_state->top_job_fifo_size = p_state->job_fifo_size; p_state->peak_job_fifo_size = p_state->job_fifo_size;
/* unlock the mutex */ /* unlock the mutex */
pthread_mutex_unlock(&job_mutex); pthread_mutex_unlock(&job_mutex);

2
snac.h
View file

@ -50,7 +50,7 @@ typedef struct {
int use_fcgi; /* FastCGI use on/off */ int use_fcgi; /* FastCGI use on/off */
time_t srv_start_time; /* start time */ time_t srv_start_time; /* start time */
int job_fifo_size; /* job fifo size */ int job_fifo_size; /* job fifo size */
int top_job_fifo_size; /* maximum job fifo size seen */ int peak_job_fifo_size; /* maximum job fifo size seen */
int n_threads; /* number of configured threads */ int n_threads; /* number of configured threads */
enum { THST_WAIT, THST_IN, THST_QUEUE, THST_STOP } th_state[MAX_THREADS]; enum { THST_WAIT, THST_IN, THST_QUEUE, THST_STOP } th_state[MAX_THREADS];
} srv_state; } srv_state;