Commit 104d3397 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

ignore 'db not found errors'

(to allow bootstrapping, if legacy links are used)
parent 63928fda
......@@ -879,19 +879,25 @@ class DockerController:
def check_db(self):
log.debug("check_db")
ses = self.session
with ses.begin():
for webapp_id, in ses.execute("""SELECT webapps.id FROM webapps
LEFT JOIN webapp_versions ON webapps.id=webapp_versions.webapp_id
WHERE sandbox_state IN (%d,%d) OR state=%d
GROUP BY webapps.id""" % (
SandboxState.starting, SandboxState.stopping, VersionState.sandbox)).fetchall():
self.sandbox_manager.process(webapp_id)
for job_id, in ses.query(Job.id).filter_by(state = JobState.WAITING.value):
log.debug("schedule job %d", job_id)
self.job_manager.process(job_id)
try:
ses = self.session
with ses.begin():
for webapp_id, in ses.execute("""SELECT webapps.id FROM webapps
LEFT JOIN webapp_versions ON webapps.id=webapp_versions.webapp_id
WHERE sandbox_state IN (%d,%d) OR state=%d
GROUP BY webapps.id""" % (
SandboxState.starting, SandboxState.stopping, VersionState.sandbox)).fetchall():
self.sandbox_manager.process(webapp_id)
for job_id, in ses.query(Job.id).filter_by(state = JobState.WAITING.value):
log.debug("schedule job %d", job_id)
self.job_manager.process(job_id)
except sqlalchemy.exc.OperationalError as e:
if e.orig.__class__.__name__ == "OperationalError" and e.orig.args[0] == 1049:
log.warning("db not found: %s", e.orig.args)
return
raise
def shutdown(self):
#TODO: graceful shutdown
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment