The timeout Statement
timeout <value> {
[ statements ]
}
The timeout statement limits the total time which a section can use
to process a particular request. If the request takes more than the
given time, it returns fail.
The <value> text can be a number, or a dynamic expansion, or an
attribute reference. The contents of <value> are interpreted as a
time_delta, with default scale in seconds.
The time scale can be changed by appending s, us, ms, ns, etc. as
with all uses of time_delta values.
timeout 1ms {
foo
bar
}
Timeout with catch
In the following example, the configuration allows the sql module to
run for 4 seconds. If the sql module takes more than 4 seconds
to return, or if the sql module fails, then the detail module is
called.
try {
timeout 4s {
sql
}
}
catch timeout {
detail
}
Timeout with redundant
The timeout can also be used inside of a
redundant block. This example has
almost the same behavior as above. The difference here is that the
detail file here is run on when either the sql module fails, or
the timeout is reached.
Whether you choose to use a redundant or a
catch block after the timeout depends on
your local requirements.
redundant
timeout 4s {
sql
}
detail
}