|
a/Allura/allura/command/taskd.py |
|
b/Allura/allura/command/taskd.py |
|
... |
|
... |
94 |
if self.task:
|
94 |
if self.task:
|
95 |
# Build the (fake) request
|
95 |
# Build the (fake) request
|
96 |
r = Request.blank('/--%s--/' % self.task.task_name, dict(task=self.task))
|
96 |
r = Request.blank('/--%s--/' % self.task.task_name, dict(task=self.task))
|
97 |
list(wsgi_app(r.environ, start_response))
|
97 |
list(wsgi_app(r.environ, start_response))
|
98 |
self.task = None
|
98 |
self.task = None
|
99 |
except Exception:
|
99 |
except Exception as e:
|
100 |
if self.keep_running:
|
100 |
if self.keep_running:
|
101 |
base.log.exception('taskd error; pausing for 10s before taking more tasks')
|
101 |
base.log.exception('taskd error %s; pausing for 10s before taking more tasks' % e)
|
102 |
time.sleep(10)
|
102 |
time.sleep(10)
|
103 |
else:
|
103 |
else:
|
104 |
base.log.exception('taskd error')
|
104 |
base.log.exception('taskd error %s' % e)
|
105 |
base.log.info('taskd pid %s stopping gracefully.' % os.getpid())
|
105 |
base.log.info('taskd pid %s stopping gracefully.' % os.getpid())
|
106 |
|
106 |
|
107 |
if self.restart_when_done:
|
107 |
if self.restart_when_done:
|
108 |
base.log.info('taskd pid %s restarting itself' % os.getpid())
|
108 |
base.log.info('taskd pid %s restarting itself' % os.getpid())
|
109 |
os.execv(sys.argv[0], sys.argv)
|
109 |
os.execv(sys.argv[0], sys.argv)
|