mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-09 06:38:12 +08:00
Don't close DB connection if async_task was called with sync=True (#301)
This commit is contained in:
+2
-1
@@ -93,7 +93,8 @@ def save_task(task, broker: Broker):
|
|||||||
broker=broker,
|
broker=broker,
|
||||||
)
|
)
|
||||||
# SAVE LIMIT > 0: Prune database, SAVE_LIMIT 0: No pruning
|
# 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:
|
try:
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|||||||
+2
-1
@@ -85,7 +85,8 @@ def worker(
|
|||||||
if not callable(f):
|
if not callable(f):
|
||||||
# locate() returns None if f cannot be loaded
|
# locate() returns None if f cannot be loaded
|
||||||
f = pydoc.locate(f)
|
f = pydoc.locate(f)
|
||||||
close_old_django_connections()
|
if not task.get("sync", False):
|
||||||
|
close_old_django_connections()
|
||||||
timer_value = task.pop("timeout", timeout)
|
timer_value = task.pop("timeout", timeout)
|
||||||
# signal execution
|
# signal execution
|
||||||
pre_execute.send(sender="django_q", func=f, task=task)
|
pre_execute.send(sender="django_q", func=f, task=task)
|
||||||
|
|||||||
Reference in New Issue
Block a user