]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add documentation for limit and timeout
authorAlan T. DeKok <aland@freeradius.org>
Tue, 15 Nov 2022 11:01:39 +0000 (06:01 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 15 Nov 2022 11:04:19 +0000 (06:04 -0500)
doc/antora/modules/reference/nav.adoc
doc/antora/modules/reference/pages/unlang/keywords.adoc
doc/antora/modules/reference/pages/unlang/limit.adoc [new file with mode: 0644]
doc/antora/modules/reference/pages/unlang/timeout.adoc [new file with mode: 0644]

index 45f85c0d2920e6e226a128f93de573e35a736e95..f26f43987c4754238ba2844b9819cd238d174490 100644 (file)
@@ -15,6 +15,7 @@
 **** 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]
@@ -22,6 +23,7 @@
 **** 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]
index 5a7ae89da8c1b8b5d74c6b679c69885d53d25162..6796412b35babdaec48d0d030de2d3f673101b41 100644 (file)
@@ -19,6 +19,8 @@ looping, etc.
 | 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.
 |=====
diff --git a/doc/antora/modules/reference/pages/unlang/limit.adoc b/doc/antora/modules/reference/pages/unlang/limit.adoc
new file mode 100644 (file)
index 0000000..1b89f46
--- /dev/null
@@ -0,0 +1,48 @@
+= 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.
diff --git a/doc/antora/modules/reference/pages/unlang/timeout.adoc b/doc/antora/modules/reference/pages/unlang/timeout.adoc
new file mode 100644 (file)
index 0000000..73cc4c1
--- /dev/null
@@ -0,0 +1,51 @@
+= 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.