1
0
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:
Jake Howard 2024-10-04 12:54:44 +01:00
parent 975fbdfbe8
commit 673f061ee2
No known key found for this signature in database
GPG Key ID: 57AFB45680EDD477
4 changed files with 6 additions and 11 deletions

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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.
"""