mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-10 14:50:56 +08:00
Don't close DB connection if async_task was called with sync=True (#301)
This commit is contained in:
@@ -93,6 +93,7 @@ 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
|
||||||
|
if not task.get("sync", False):
|
||||||
close_old_django_connections()
|
close_old_django_connections()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ 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)
|
||||||
|
if not task.get("sync", False):
|
||||||
close_old_django_connections()
|
close_old_django_connections()
|
||||||
timer_value = task.pop("timeout", timeout)
|
timer_value = task.pop("timeout", timeout)
|
||||||
# signal execution
|
# signal execution
|
||||||
|
|||||||
Reference in New Issue
Block a user