mirror of
https://github.com/django/django.git
synced 2025-06-08 21:19:13 +00:00
Cleanup from first pass review
This commit is contained in:
parent
975fbdfbe8
commit
673f061ee2
@ -13,6 +13,7 @@ from .task import (
|
||||
|
||||
__all__ = [
|
||||
"tasks",
|
||||
"default_task_backend",
|
||||
"DEFAULT_TASK_BACKEND_ALIAS",
|
||||
"DEFAULT_QUEUE_NAME",
|
||||
"task",
|
||||
@ -26,10 +27,7 @@ class TasksHandler(BaseConnectionHandler):
|
||||
exception_class = InvalidTaskBackendError
|
||||
|
||||
def create_connection(self, alias):
|
||||
params = self.settings[alias].copy()
|
||||
|
||||
# Added back to allow a backend to self-identify
|
||||
params["ALIAS"] = alias
|
||||
params = self.settings[alias]
|
||||
|
||||
backend = params["BACKEND"]
|
||||
|
||||
@ -40,7 +38,7 @@ class TasksHandler(BaseConnectionHandler):
|
||||
f"Could not find backend '{backend}': {e}"
|
||||
) from e
|
||||
|
||||
return backend_cls(params)
|
||||
return backend_cls({**params, "ALIAS": alias})
|
||||
|
||||
|
||||
tasks = TasksHandler()
|
||||
|
@ -39,7 +39,7 @@ class BaseTaskBackend(metaclass=ABCMeta):
|
||||
if not connections.settings:
|
||||
return False
|
||||
|
||||
if isinstance(task.enqueue_on_commit, bool):
|
||||
if task.enqueue_on_commit is not None:
|
||||
return task.enqueue_on_commit
|
||||
|
||||
return self.enqueue_on_commit
|
||||
|
@ -8,7 +8,4 @@ def check_tasks(app_configs=None, **kwargs):
|
||||
from django.tasks import tasks
|
||||
|
||||
for backend in tasks.all():
|
||||
try:
|
||||
yield from backend.check()
|
||||
except NotImplementedError:
|
||||
pass
|
||||
yield from backend.check()
|
||||
|
@ -3,7 +3,7 @@ from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
||||
|
||||
class InvalidTaskError(Exception):
|
||||
"""
|
||||
The provided task function is invalid.
|
||||
The provided task is invalid.
|
||||
"""
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user