**** xref:unlang/group.adoc[group]
**** xref:unlang/if.adoc[if]
**** xref:unlang/load-balance.adoc[load-balance]
+**** xref:unlang/limit.adoc[limit]
**** xref:unlang/map.adoc[map]
**** xref:unlang/parallel.adoc[parallel]
**** xref:unlang/redundant-load-balance.adoc[redundant-load-balance]
**** xref:unlang/return.adoc[return]
**** xref:unlang/subrequest.adoc[subrequest]
**** xref:unlang/switch.adoc[switch]
+**** xref:unlang/timeout.adoc[timeout]
**** xref:unlang/update.adoc[update]
*** xref:unlang/interpreter.adoc[Interpreter]
| xref:unlang/elsif.adoc[elsif] | Check for condition when a previous `if` does not match.
| xref:unlang/foreach.adoc[foreach] | Loop over a list of attributes.
| xref:unlang/if.adoc[if] | Check for a condition, and execute a sub-policy if it matches.
+| xref:unlang/limit.adoc[limit] | Limit the number of requests in a section
+| xref:unlang/timeout.adoc[timeout] | Enforce a timeout for processing a section
| xref:unlang/return.adoc[return] | Immediately stop processing a section.
| xref:unlang/switch.adoc[switch] | Check for multiple values.
|=====
--- /dev/null
+= The limit Statement
+
+.Syntax
+[source,unlang]
+----
+limit <value> {
+ [ statements ]
+}
+----
+
+.Description
+The `limit` statement limits the number of requests which are actively
+being processed through a section. If too many requests are being
+processed through the `limit` section, it immediately returns `fail`.
+
+The _<value>_ text can be a number, or a dynamic expansion, or an
+attribute reference. The contents of _<value>_ are interpreted as an
+integer `uint32` data type.
+
+.Example
+[source,unlang]
+----
+limit 4 {
+ foo
+ bar
+}
+----
+
+In general, the best way to use `limit` is in conjunction with a
+`redundant` block. In the following example, the configuration allows
+`4` packets to be outstanding in the `proxy` module. If more than `4`
+packets are outstanding, _or_ if the `proxy` module fails, the
+`detail` module is called.
+
+.Example using redundant
+[source,unlang]
+----
+redundant
+ limit 4 {
+ proxy
+ }
+
+ detail
+}
+----
+
+// Copyright (C) 2022 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
+// Development of this documentation was sponsored by Network RADIUS SAS.
--- /dev/null
+= The timeout Statement
+
+.Syntax
+[source,unlang]
+----
+timeout <value> {
+ [ statements ]
+}
+----
+
+.Description
+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.
+
+.Example
+[source,unlang]
+----
+timeout 1ms {
+ foo
+ bar
+}
+----
+
+In general, the best way to use `timeout` is in conjunction with a
+`redundant` block. In the following example, the configuration allows
+the `proxy` module to run for `4` seconds. If the `proxy` module
+takes more than `4` seconds to return, _or_ if the `proxy` module
+fails, the `detail` module is called.
+
+.Example using redundant
+[source,unlang]
+----
+redundant
+ timeout 4s {
+ proxy
+ }
+
+ detail
+}
+----
+
+// Copyright (C) 2022 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
+// Development of this documentation was sponsored by Network RADIUS SAS.