Respect done statefulness of each agent when restoring jobs on startup


This patch fixes an issue where if one agent assigned to a job
completes the work, but another has not for any reason, the agent
which has already completed the job will be assigned the work again.
This was due to the recovery logic not respecting the done state
of the agent, assigning work to all agents if any agent was not
done. This issue is fixed by only assigning work to agents which
are not done, and correctly marking job_done for the job if all agents
are done or an agent which is not done becomes stale.

Change-Id: I8c441cafd42941741a858cd78542ebe11c1075d7
Reviewed-by: Audun Sutterud <audun.sutterud@qt.io>
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
commit488acbec08abad495e615dabb47908d6fd38181d
parent0e51f20b502eae2fc61f751557f08f5649b909e8
authorDaniel Smith <daniel.smith@qt.io>
committerDaniel Smith <daniel.smith@qt.io>
commit timeMon, 15 Jan 2024 09:21:18 +0100