Merge pull request #2930 from coreos-inc/joseph.schorr/QS-68/squashed-image-postgres

Make sure to close the database connection before forking in verbs
This commit is contained in:
josephschorr 2017-12-06 14:03:17 -05:00 committed by GitHub
commit 10ddf98e0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -250,6 +250,11 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
logger.debug('Building and returning derived %s image %s', verb, derived_image.ref)
# Close the database connection before any process forking occurs. This is important because
# the Postgres driver does not react kindly to forking, so we need to make sure it is closed
# so that each process will get its own unique connection.
database.close_db_filter(None)
# Calculate a derived image ID.
derived_image_id = hashlib.sha256(repo_image.image_id + ':' + verb).hexdigest()