Skip to content

Commit

Permalink
Use sync_to_async to mitigate DB connection issues
Browse files Browse the repository at this point in the history
closes #9385
Required PR: pulp/pulpcore#1625
  • Loading branch information
ipanova committed Sep 17, 2021
1 parent 20096ce commit f75dea2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES/9385.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use sync_to_async to mitigate DB connection issues and comply with Django 3.2 ORM usage in async
code.
3 changes: 2 additions & 1 deletion pulp_container/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ async def run(self):

for manifest_future in future_manifests:
man = await manifest_future.resolution()
with man._artifacts.get().file.open() as content_file:
artifact = await sync_to_async(man._artifacts.get)()
with artifact.file.open() as content_file:
raw = content_file.read()
content_data = json.loads(raw)
man_dc = man_dcs[man.digest]
Expand Down

0 comments on commit f75dea2

Please sign in to comment.