From 7cd83e15139447156ca915ce2d9d19295c146d56 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 15 May 2023 15:31:33 +0200 Subject: rework server-worker communication OK, this is a major rework. * tcp_server: connection threads are not detached anymore, the caller has to clean them up. This was done so that the server can clean up the threads cleanly. * run_queue: simple refactoring, run_queue_entry is called just run now. * server: worker threads are now killed when a run is assigned to a worker. * worker: the connection to server is no longer persistent. A worker sends "new-worker", waits for a task, closes the connection, and when it's done, sends the "complete" message and waits for a new task. This is supposed to improve resilience, since the worker-server connections don't have to be maintained while the worker is doing a CI run. --- src/worker_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/worker_main.c') diff --git a/src/worker_main.c b/src/worker_main.c index c046ba0..b9e9b9b 100644 --- a/src/worker_main.c +++ b/src/worker_main.c @@ -70,11 +70,11 @@ int main(int argc, char *argv[]) if (ret < 0) return ret; - ret = worker_create(&worker, &settings); + ret = worker_create(&worker); if (ret < 0) return ret; - ret = worker_main(worker, argc - optind, argv + optind); + ret = worker_main(worker, &settings); if (ret < 0) goto destroy_worker; -- cgit v1.2.3