Mercurial > sci
diff sciworkerd/sciworkerd.c @ 85:cf49ab595e2e default tip @
sciworkerd: avoid spawning several tasks
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 09 Mar 2023 10:43:48 +0100 |
parents | f3fc80a2bed7 |
children |
line wrap: on
line diff
--- a/sciworkerd/sciworkerd.c Thu Mar 09 10:42:31 2023 +0100 +++ b/sciworkerd/sciworkerd.c Thu Mar 09 10:43:48 2023 +0100 @@ -77,10 +77,19 @@ { const struct taskentry *iter; + /* Check if that task is listed for build. */ LL_FOREACH(taskpending, iter) if (iter->job_id == job_id) return 1; + /* + * But also make sure we don't add tasks that are already running as + * well. + */ + LL_FOREACH(tasks, iter) + if (iter->job_id == job_id) + return 1; + return 0; }