From 156edd022ef315eb68e0f7002994dfeb172a25c1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 6 May 2023 15:54:55 +0200 Subject: shut down server/workers gracefully on SIGTERM --- src/worker.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/worker.c') diff --git a/src/worker.c b/src/worker.c index 05243ac..7471cd1 100644 --- a/src/worker.c +++ b/src/worker.c @@ -195,8 +195,13 @@ int worker_main(struct worker *worker, UNUSED int argc, UNUSED char *argv[]) log("Waiting for a new command\n"); ret = msg_recv(worker->fd, &request); - if (ret < 0) + if (ret < 0) { + if (errno == EINVAL && global_stop_flag) { + ret = 0; + break; + } return ret; + } ret = worker_msg_handler(worker, &request); msg_free(&request); -- cgit v1.2.3