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
The sequence is explicit listener configuration. Router brokers outside the
36
+
sequence are started in client mode for routed sends and are not consumed by
37
+
this worker. A single broker target keeps its existing lifecycle. Execution,
38
+
prefetch and tasks-per-child limits apply to the whole worker process, not once
39
+
per listener. See [Routing and flows](./routing-and-flows.md) for validation,
40
+
lifecycle and adapter compatibility details.
41
+
21
42
### Sync function
22
43
23
44
Taskiq can run synchronous functions. However, since it operates asynchronously, it executes them in a separate thread or process. By default, **ThreadPoolExecutor** is used. But if you're planning to use Taskiq for heavy computations, such as neural network model training or other CPU-intensive tasks, you may want to use **ProcessPoolExecutor** instead.
@@ -146,7 +167,14 @@ kill -HUP <main pid>
146
167
If you send `SIGINT` or `SIGKILL` to the main process by pressing <kbd>Ctrl</kbd>+<kbd>C</kbd> or using the `kill` command, it will initiate the shutdown process.
147
168
By default, it will stop fetching new messages immediately after receiving the signal but will wait for the completion of all currently executing tasks.
148
169
149
-
If you don't want to wait too long for tasks to complete each time you shut down the worker, you can either send termination signals three times to the main process to perform a hard kill or configure the `--wait-tasks-timeout` to set a hard time limit for shutting down.
170
+
If you don't want to wait indefinitely for tasks to complete during worker shutdown, you can either send termination signals three times to the main process to perform a hard kill or configure `--wait-tasks-timeout` as the graceful callback boundary.
171
+
172
+
When `--wait-tasks-timeout` is omitted, Taskiq keeps the legacy behavior and
173
+
waits for the complete listener shutdown, including running callbacks, without
174
+
a time limit. When the task timeout is configured, `--shutdown-timeout` is also
175
+
the post-drain listener cleanup allowance. Every managed broker then receives
176
+
its own `--shutdown-timeout` deadline, so total multi-broker cleanup can take
177
+
longer than that value.
150
178
151
179
::: tip Cool tip
152
180
The number of signals before a hard kill can be configured with the `--hardkill-count` CLI argument.
@@ -170,8 +198,8 @@ The number of signals before a hard kill can be configured with the `--hardkill-
170
198
*`--ack-type` - Type of acknowledgement. This parameter is used to set when to acknowledge the task. Possible values are `when_received`, `when_executed`, `when_saved`, `manual`. Default is `when_saved`.
171
199
*`--max-tasks-per-child` - maximum number of tasks to be executed by a single worker process before restart.
172
200
*`--max-fails` - Maximum number of child process exits.
173
-
*`--shutdown-timeout` - maximum amount of time for graceful broker's shutdown in seconds (default 5).
174
-
*`--wait-tasks-timeout` - if cannot read new messages from the broker or maximum number of tasks is reached, worker will wait for all current tasks to finish. This parameter sets the maximum amount of time to wait until shutdown.
201
+
*`--shutdown-timeout` - maximum graceful shutdown time for each managed brokerin seconds (default 5). With `--wait-tasks-timeout`, the same value is also the listener's post-drain cleanup allowance.
202
+
*`--wait-tasks-timeout` - maximum graceful wait for active task callbacks before Taskiq cancels and awaits them. When omitted, callback and listener shutdown remains unbounded for backward compatibility.
175
203
*`--hardkill-count` - Number of termination signals to the main process before performing a hardkill.
0 commit comments