Don't close DB connection if async_task was called with sync=True (#301)

This commit is contained in:
Seba
2026-03-12 15:33:19 +01:00
committed by GitHub
parent 573b8da528
commit 01df35c923
2 changed files with 4 additions and 2 deletions

View File

@@ -93,7 +93,8 @@ def save_task(task, broker: Broker):
broker=broker,
)
# SAVE LIMIT > 0: Prune database, SAVE_LIMIT 0: No pruning
close_old_django_connections()
if not task.get("sync", False):
close_old_django_connections()
try:
filters = {}

View File

@@ -85,7 +85,8 @@ def worker(
if not callable(f):
# locate() returns None if f cannot be loaded
f = pydoc.locate(f)
close_old_django_connections()
if not task.get("sync", False):
close_old_django_connections()
timer_value = task.pop("timeout", timeout)
# signal execution
pre_execute.send(sender="django_q", func=f, task=task)