-
Notifications
You must be signed in to change notification settings - Fork 45
Using the DEFAULT_TASK_BACKEND_ALIAS constant #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| if TYPE_CHECKING: | ||
| from .backends.base import BaseTaskBackend | ||
|
|
||
| DEFAULT_TASK_BACKEND_ALIAS = "default" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am really not sure about the location of that constant. The locations where I wanted to put it produced circular imports, though... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is why I just duplicated it instead. Tests should cover if they're different. |
||
| DEFAULT_QUEUE_NAME = "default" | ||
|
|
||
|
|
||
|
|
@@ -151,7 +152,7 @@ def module_path(self) -> str: | |
| def task( | ||
| priority: int = 0, | ||
| queue_name: str = DEFAULT_QUEUE_NAME, | ||
| backend: str = "default", | ||
| backend: str = DEFAULT_TASK_BACKEND_ALIAS, | ||
| ) -> Callable[[Callable[P, T]], Task[P, T]]: | ||
| """ | ||
| A decorator used to create a task. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: As discussed, we should document that it should be called "default" (as with
DATABASES).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But even if discarding the rest of the PR, we could still reference that variable instead of writing
defaultagain, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT_TASK_BACKEND_ALIASisn't really part of the public API, so people shouldn't need to use it.