diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-13 03:52:52 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-13 03:52:52 +0200 |
commit | e0253448a1ad70bd7530e64e88b81fa4ed627af4 (patch) | |
tree | 6886fc576fef157625c96224a8dec0d5bb36c9dc /src/server.c | |
parent | event_loop: support more event types (diff) | |
download | cimple-e0253448a1ad70bd7530e64e88b81fa4ed627af4.tar.gz cimple-e0253448a1ad70bd7530e64e88b81fa4ed627af4.zip |
server: handle disconnected workers gracefully
Diffstat (limited to 'src/server.c')
-rw-r--r-- | src/server.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/server.c b/src/server.c index 39a4aa3..0e771df 100644 --- a/src/server.c +++ b/src/server.c @@ -150,10 +150,8 @@ static int server_wait_for_action(struct server *server) return ret; } -static int server_assign_run(struct server *server) +static void server_assign_run(struct server *server) { - int ret = 0; - struct run *run = run_queue_remove_first(&server->run_queue); log("Removed run for repository %s from the queue\n", run_get_url(run)); @@ -161,7 +159,7 @@ static int server_assign_run(struct server *server) log("Removed worker %d from the queue\n", worker_get_fd(worker)); const char *argv[] = {CMD_RUN, run_get_url(run), run_get_rev(run), NULL}; - ret = msg_talk_argv(worker_get_fd(worker), argv, NULL); + int ret = msg_talk_argv(worker_get_fd(worker), argv, NULL); if (ret < 0) { log("Failed to assign run for repository %s to worker %d, requeueing\n", @@ -174,8 +172,6 @@ static int server_assign_run(struct server *server) } worker_destroy(worker); - - return ret; } static void *server_main_thread(void *_server) @@ -195,9 +191,7 @@ static void *server_main_thread(void *_server) if (server->stopping) goto unlock; - ret = server_assign_run(server); - if (ret < 0) - goto unlock; + server_assign_run(server); } unlock: |