Skip to content

Commit 501827e

Browse files
committed
DOC: lua: fix yield-dependent methods expected contexts
Contrary to what the doc states, it is not expected (nor relevant) to use yield-dependent methods such as core.yield() or core.(m)sleep() from contexts that don't support yielding. Such contexts include body, init, fetches and converters. Thus the doc got it wrong since the beginning, because such methods were never supported from the above contexts, yet it was listed in the list of compatible contexts (probably the result of a copy-paste), which is error-prone because it could either cause a Lua runtime error to be thrown, or be ignored in some other cases. It should be backported to all stable versions.
1 parent 6f746af commit 501827e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/lua-api/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Core class
485485
486486
.. js:function:: core.msleep(milliseconds)
487487

488-
**context**: body, init, task, action
488+
**context**: task, action
489489

490490
The `core.msleep()` stops the Lua execution between specified milliseconds.
491491

@@ -841,7 +841,7 @@ Core class
841841

842842
.. js:function:: core.sleep(int seconds)
843843

844-
**context**: body, init, task, action
844+
**context**: task, action
845845

846846
The `core.sleep()` functions stop the Lua execution between specified seconds.
847847

@@ -894,7 +894,7 @@ Core class
894894

895895
.. js:function:: core.yield()
896896

897-
**context**: task, action, sample-fetch, converter
897+
**context**: task, action
898898

899899
Give back the hand at the HAProxy scheduler. It is used when the LUA
900900
processing consumes a lot of processing time.

0 commit comments

Comments
 (0)