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 timeout.
- <value>
-
A number, or a dynamic expansion, or an attribute reference. The value is 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 oftime_deltavalues.Negative times, and times less than 1us are treated as zero. The
timeoutsection does not run, but instead immediately returns thetimeoutrcode.
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 behaviour 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
}
|
If the timeout value is taken from a dynamic expansion or attribute
reference which fails, the entire |