Clarify why we need database.UserThenDisconnect
This commit is contained in:
parent
555bd293ea
commit
bc119aed22
1 changed files with 14 additions and 9 deletions
|
@ -61,6 +61,9 @@ def _sign_sythentic_image(verb, linked_storage_uuid, queue_file):
|
||||||
logger.exception('Exception when signing %s image %s', verb, linked_storage_uuid)
|
logger.exception('Exception when signing %s image %s', verb, linked_storage_uuid)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Setup the database (since this is a new process) and then disconnect immediately
|
||||||
|
# once the operation completes.
|
||||||
|
if not queue_file.raised_exception:
|
||||||
with database.UseThenDisconnect(app.config):
|
with database.UseThenDisconnect(app.config):
|
||||||
try:
|
try:
|
||||||
derived = model.get_storage_by_uuid(linked_storage_uuid)
|
derived = model.get_storage_by_uuid(linked_storage_uuid)
|
||||||
|
@ -89,6 +92,8 @@ def _write_synthetic_image_to_storage(verb, linked_storage_uuid, linked_location
|
||||||
queue_file.close()
|
queue_file.close()
|
||||||
|
|
||||||
if not queue_file.raised_exception:
|
if not queue_file.raised_exception:
|
||||||
|
# Setup the database (since this is a new process) and then disconnect immediately
|
||||||
|
# once the operation completes.
|
||||||
with database.UseThenDisconnect(app.config):
|
with database.UseThenDisconnect(app.config):
|
||||||
done_uploading = model.get_storage_by_uuid(linked_storage_uuid)
|
done_uploading = model.get_storage_by_uuid(linked_storage_uuid)
|
||||||
done_uploading.uploading = False
|
done_uploading.uploading = False
|
||||||
|
|
Reference in a new issue