Skip to content

Commit 5fe0ba8

Browse files
p7novpatiencedaur
andauthored
Clarify trigger event context (#2965)
Resolves #2538 Co-authored-by: Dia Patience Daur <[email protected]>
1 parent 8b9add9 commit 5fe0ba8

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

doc/book/box/triggers.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
.. _triggers:
44
.. _triggers-box_triggers:
55

6-
================================================================================
76
Triggers
8-
================================================================================
7+
========
98

109
**Triggers**, also known as **callbacks**, are functions which the server
1110
executes when certain events happen.
1211

1312
To associate an event with a callback,
14-
one should pass the callback to the corresponding :samp:`on_{event}` function:
13+
pass the callback to the corresponding :samp:`on_{event}` function:
1514

1615
* :doc:`/reference/reference_lua/box_session/on_connect` or
1716
:doc:`/reference/reference_lua/box_session/on_disconnect`,
@@ -47,12 +46,12 @@ All triggers have the following characteristics:
4746
* There can be multiple triggers for one event. In this case, triggers are
4847
executed in the reverse order that they were defined in.
4948

50-
* Triggers must work within the event context. However, effects are undefined
51-
if a function contains requests which normally could not occur immediately
52-
after the event, but only before the return from the event. For example, putting
53-
`os.exit() <http://www.lua.org/manual/5.1/manual.html#pdf-os.exit>`_ or
54-
:doc:`/reference/reference_lua/box_txn_management/rollback` in a trigger
55-
function would be bringing in requests outside the event context.
49+
* Triggers must work within the event context, that is, operate variables passed
50+
as the trigger function arguments. Triggers should not affect the global state
51+
of the program or change things unrelated to the event. If a trigger performs
52+
such calls as, for example, `os.exit() <http://www.lua.org/manual/5.1/manual.html#pdf-os.exit>`_
53+
or :doc:`/reference/reference_lua/box_txn_management/rollback`, the result of
54+
its execution is undefined.
5655

5756
* Triggers are replaceable. The request to "redefine a trigger" implies
5857
passing a new trigger function and an old trigger function

locale/ru/LC_MESSAGES/book/box/triggers.po

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ msgstr ""
1111
"событий."
1212

1313
msgid ""
14-
"To associate an event with a callback, one should pass the callback to the "
14+
"To associate an event with a callback, pass the callback to the "
1515
"corresponding :samp:`on_{event}` function:"
1616
msgstr ""
17-
"Чтобы связать событие с колбэк-функцией, необходимо передать её в "
17+
"Чтобы связать событие с колбэк-функцией, передайте её в "
1818
"соответствующую функцию обработки событий :samp:`on_{event}`:"
1919

2020
msgid ""
@@ -110,20 +110,20 @@ msgstr ""
110110
"определили."
111111

112112
msgid ""
113-
"Triggers must work within the event context. However, effects are undefined "
114-
"if a function contains requests which normally could not occur immediately "
115-
"after the event, but only before the return from the event. For example, "
116-
"putting `os.exit() <http://www.lua.org/manual/5.1/manual.html#pdf-os.exit>`_"
117-
" or :doc:`/reference/reference_lua/box_txn_management/rollback` in a trigger"
118-
" function would be bringing in requests outside the event context."
119-
msgstr ""
120-
"Триггеры должны работать в контексте события. Однако результат не определен,"
121-
" если функция содержит запросы, которые при нормальных условиях не могут "
122-
"быть выполнены непосредственно после события, а только после возврата из "
123-
"события. Например, если указать `os.exit() "
124-
"<http://www.lua.org/manual/5.1/manual.html#pdf-os.exit>`_ или "
125-
":doc:`/reference/reference_lua/box_txn_management/rollback` в триггерной "
126-
"функции, запросы не будут выполняться в контексте события."
113+
"Triggers must work within the event context, that is, operate variables passed "
114+
"as the trigger function arguments. Triggers should not affect the global state "
115+
"of the program or change things unrelated to the event. If a trigger performs "
116+
"such calls as, for example, `os.exit() <http://www.lua.org/manual/5.1/manual.html#pdf-os.exit>`_ "
117+
"or :doc:`/reference/reference_lua/box_txn_management/rollback`, the result of "
118+
"its execution is undefined."
119+
msgstr ""
120+
"Триггеры должны работать в контексте события, то есть оперировать переменными, "
121+
"которые переданы как аргументы его функции. Триггеры не должны влиять на "
122+
"глобальное состояние программы или менять параметры, не связанные с событием. "
123+
"Если триггер выполняет такие вызовы, как, например, "
124+
"`os.exit() <http://www.lua.org/manual/5.1/manual.html#pdf-os.exit>`_ "
125+
"или :doc:`/reference/reference_lua/box_txn_management/rollback`, "
126+
"результат его выполнения не определен."
127127

128128
msgid ""
129129
"Triggers are replaceable. The request to \"redefine a trigger\" implies "

0 commit comments

Comments
 (0)