mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
Pass alias and params separately to backend
This commit is contained in:
parent
a6153630ad
commit
c92a97267a
@ -38,7 +38,7 @@ class TasksHandler(BaseConnectionHandler):
|
|||||||
f"Could not find backend '{backend}': {e}"
|
f"Could not find backend '{backend}': {e}"
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
return backend_cls({**params, "ALIAS": alias})
|
return backend_cls(alias=alias, params=params)
|
||||||
|
|
||||||
|
|
||||||
tasks = TasksHandler()
|
tasks = TasksHandler()
|
||||||
|
@ -24,10 +24,10 @@ class BaseTaskBackend(metaclass=ABCMeta):
|
|||||||
supports_get_result = False
|
supports_get_result = False
|
||||||
"""Can results be retrieved after the fact (from **any** thread / process)"""
|
"""Can results be retrieved after the fact (from **any** thread / process)"""
|
||||||
|
|
||||||
def __init__(self, options):
|
def __init__(self, alias, params):
|
||||||
self.alias = options["ALIAS"]
|
self.alias = alias
|
||||||
self.queues = set(options.get("QUEUES", [DEFAULT_QUEUE_NAME]))
|
self.queues = set(params.get("QUEUES", [DEFAULT_QUEUE_NAME]))
|
||||||
self.enqueue_on_commit = bool(options.get("ENQUEUE_ON_COMMIT", True))
|
self.enqueue_on_commit = bool(params.get("ENQUEUE_ON_COMMIT", True))
|
||||||
|
|
||||||
def _get_enqueue_on_commit_for_task(self, task):
|
def _get_enqueue_on_commit_for_task(self, task):
|
||||||
"""
|
"""
|
||||||
|
@ -16,8 +16,8 @@ class DummyBackend(BaseTaskBackend):
|
|||||||
supports_defer = True
|
supports_defer = True
|
||||||
supports_async_task = True
|
supports_async_task = True
|
||||||
|
|
||||||
def __init__(self, options) -> None:
|
def __init__(self, alias, params) -> None:
|
||||||
super().__init__(options)
|
super().__init__(alias, params)
|
||||||
|
|
||||||
self.results = []
|
self.results = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user