masterd: Shutdown only once running jobs have been processed
authorMichael Hanselmann <hansmi@google.com>
Thu, 17 Nov 2011 11:07:57 +0000 (12:07 +0100)
committerMichael Hanselmann <hansmi@google.com>
Mon, 21 Nov 2011 07:36:29 +0000 (08:36 +0100)
commit5483fd739f21071e98aeff1805cd172f59691b7f
treead8726e178288e059c318d92441b7ec41eae1cfd
parent2d6b541445a6791fb620be2910bf31162ce3ae4f
masterd: Shutdown only once running jobs have been processed

Until now, if masterd received a fatal signal, it would start shutting
down immediately. In the meantime it would hang while jobs are still
processed. Clients couldn't connect anymore to retrieve a jobs' status.

This this patch masterd checks if any job is running before shutting
down. If there is it'll check again every five seconds. Once all jobs
are finished, it waits another five seconds to give clients a chance to
retrieve the jobs' status. After that masterd will shutdown in a clean
fashion.

If a second signal is received the old behaviour is preserved.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
lib/server/masterd.py