Skip to content

Commit 54df0c4

Browse files
committed
minor #16512 Workflow - Add a note about guards events and ability to save some CPU (kissifrot)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- Workflow - Add a note about guards events and ability to save some CPU As a follow up of symfony/symfony#45172, I'm adding a note mentioning ability to disable announce events to lower calls in guard events. Had to add a reference to next paragraph in case it would move elsewhere 🙂 This is my first doc PR so don't hesitate to guide me 🙂 <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- e5c176c Workflow - Add a note about guards events and ability to save some CPU
2 parents 2a14cfd + e5c176c commit 54df0c4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

workflow.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,16 @@ missing a title::
509509

510510
The optional second argument of ``setBlocked()`` was introduced in Symfony 5.1.
511511

512+
.. note::
513+
514+
When using guard listeners which imply intensive workloads (CPU, Database
515+
or longer-running code blocks), if you only want them to be fired when strictly
516+
necessary (only when ``Workflow::can()`` or ``Workflow::apply()`` is executed),
517+
be sure to disable ``Workflow::DISABLE_ANNOUNCE_EVENT`` as indicated in
518+
:ref:`Choosing which Events to Dispatch <workflow-chosing-events-to-dispatch>`
519+
520+
.. _workflow-chosing-events-to-dispatch:
521+
512522
Choosing which Events to Dispatch
513523
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
514524

0 commit comments

Comments
 (0)