From 94d69740dde87b33848c4183cf2f03fbb5861e35 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 26 Jun 2014 15:23:37 +0000 Subject: Add --ghost-timeout option to WEBAPP --- lorry-controller-webapp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lorry-controller-webapp') diff --git a/lorry-controller-webapp b/lorry-controller-webapp index 9234498..faabb2d 100755 --- a/lorry-controller-webapp +++ b/lorry-controller-webapp @@ -28,6 +28,9 @@ from flup.server.fcgi import WSGIServer import lorrycontroller +ONE_MINUTE = 60 + + class WEBAPP(cliapp.Application): def add_settings(self): @@ -110,6 +113,22 @@ class WEBAPP(cliapp.Application): metavar='DIR', default='/usr/share/lorry-controller/static') + # The default value of ten minutes for the ghost-timeout + # setting was chosen arbitrarily, by Lars Wirzenius. The value + # needs to be long enough that there's no realistic danger of + # hitting it just because a host is a bit overloaded, but + # still short enough that ghost jobs do get removed often + # enough, especially right after boot, when all jobs are + # ghosts. Experience may show that a different value would + # actually be better, and if so, the code and this comment + # should be changed accordingly. + self.settings.integer( + ['ghost-timeout'], + 'running jobs should get an update from their ' + 'MINION within this time or they will be considered ' + 'ghosts and be removed from STATEDB (in seconds)', + default=10*ONE_MINUTE) + def find_routes(self): '''Return all classes that are API routes. -- cgit v1.2.1