You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,8 +67,9 @@ The task decorator accepts a few arguments to customize the task:
67
67
-`priority`: The priority of the task (between -100 and 100. Larger numbers are higher priority. 0 by default)
68
68
-`queue_name`: Whether to run the task on a specific queue
69
69
-`backend`: Name of the backend for this task to use (as defined in `TASKS`)
70
+
-`enqueue_on_commit`: Whether the task is enqueued when the current transaction commits successfully, or enqueued immediately. By default, this is handled by the backend (see below). `enqueue_on_commit` may not be modified with `.using`.
70
71
71
-
These attributes can also be modified at run-time with `.using`:
72
+
These attributes (besides `enqueue_on_commit`) can also be modified at run-time with `.using`:
@@ -90,9 +91,9 @@ If the task takes arguments, these can be passed as-is to `enqueue`.
90
91
91
92
#### Transactions
92
93
93
-
By default, it's up to the backend to determine whether the task should be enqueued immediately (after calling `.enqueue`) or wait until the end of the current database transaction (if there is one).
94
+
By default, tasks are enqueued after the current transaction (if there is one) commits successfully (using Django's `transaction.on_commit` method), rather than enqueueing immediately.
94
95
95
-
This can be configured using the `ENQUEUE_ON_COMMIT` setting. `True` and `False` force the behaviour, and `None` is used to let the backend decide.
96
+
This can be configured using the `ENQUEUE_ON_COMMIT` setting. `True` and `False` force the behaviour.
96
97
97
98
```python
98
99
TASKS= {
@@ -103,7 +104,7 @@ TASKS = {
103
104
}
104
105
```
105
106
106
-
All built-in backends default to waiting for the end of the transaction (`"ENQUEUE_ON_COMMIT": True`).
107
+
This can also be configured per-task by passing `enqueue_on_commit` to the `task` decorator.
0 commit comments