summaryrefslogtreecommitdiff
path: root/lorry-controller-webapp
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-06-26 15:23:37 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-09-04 16:24:32 +0000
commit94d69740dde87b33848c4183cf2f03fbb5861e35 (patch)
tree0147c430a33eb19fb03af8459181e71035db293b /lorry-controller-webapp
parent965f5f04cb6a105764c537e3a213d72fbdc71548 (diff)
downloadlorry-controller-94d69740dde87b33848c4183cf2f03fbb5861e35.tar.gz
Add --ghost-timeout option to WEBAPP
Diffstat (limited to 'lorry-controller-webapp')
-rwxr-xr-xlorry-controller-webapp19
1 files changed, 19 insertions, 0 deletions
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.