Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Lifecycle of a Task: Timeout Evaluation


Timeouts help create a good customer experience by ensuring that a Task never gets "stuck" in a Queue with no available workers. Timeout behaviors can be tricky to master, but once you do, they'll give you fine-grained control over the movement of your Tasks through your Workflows.

Consider the following Workflow:


The Code

the-code page anchor

_23
{
_23
"task_routing": {
_23
"filters": [
_23
{
_23
"targets": [
_23
{
_23
"queue": "Q1",
_23
"timeout": 10
_23
},
_23
{
_23
"queue": "Q2",
_23
"timeout": 10
_23
},
_23
{
_23
"queue": "Q3",
_23
"timeout": 10
_23
},
_23
],
_23
"expression": "1==1"
_23
}
_23
]
_23
}
_23
}

The reservation timeout is 5 seconds.

(information)

Info

For the sake of simpler visualization and reasoning, we've artificially increased the time it takes to create a Reservation - your Workflows will likely run much faster than the one described here!


An animated rendering of Task Evaluation.
  1. Task A is created against the Workflow.
  2. At t=3, a Reservation created for Task A against Q1.
  3. At t=8, the reservation times out for Task A.
  4. Task A re-evaluates and maps to Q2.

The Queue timeout is now the sum of Q1 and Q2 timeouts: 20. The target timeout for this task will happen in 12 sec, however, because it is based on the Task's current time. Unlike the Reservation Timeout (which always starts at zero), the queue timeout will be based on the current age of the Task.


  • Review the Task State Lifecycle and how a Task moves from pending to completed
  • Review the Workflow and Assignment Lifecycle and how TaskRouter finds a Worker to whom it can assign a Task
  • Start configuring your own Workflows

Rate this page: