mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-04-06 01:04:22 +00:00
use flush, refresh and rollback instead of intemediate commit statements
This commit is contained in:
parent
07191b36b2
commit
2b1a74efb8
@ -51,13 +51,13 @@ def service(service):
|
|||||||
service_version=form.version.data,
|
service_version=form.version.data,
|
||||||
status='preparing', title=form.title.data)
|
status='preparing', title=form.title.data)
|
||||||
db.session.add(job)
|
db.session.add(job)
|
||||||
db.session.commit()
|
db.session.flush()
|
||||||
|
db.session.refresh(job)
|
||||||
try:
|
try:
|
||||||
os.makedirs(job.path)
|
os.makedirs(job.path)
|
||||||
except OSError:
|
except OSError:
|
||||||
logging.error('Make dir {} led to an OSError!'.format(job.path))
|
logging.error('Make dir {} led to an OSError!'.format(job.path))
|
||||||
db.session.delete(job)
|
db.session.rollback()
|
||||||
db.session.commit()
|
|
||||||
flash('Internal Server Error', 'error')
|
flash('Internal Server Error', 'error')
|
||||||
return make_response(
|
return make_response(
|
||||||
{'redirect_url': url_for('.service', service=service)}, 500)
|
{'redirect_url': url_for('.service', service=service)}, 500)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user