Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scheduler] Periodical triggers timing #20447

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from

Conversation

codedmonkey
Copy link
Contributor

@codedmonkey codedmonkey commented Dec 7, 2024

Improves the explanation of periodical triggers in the Scheduler component.

Related to #20349

$until = '2023-06-12';
RecurringMessage::every('first Monday of next month', new Message(), from: $from, until: $until);

If you don't pass a from parameter to your schedule, the first frequency period
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this paragraph with the first one you added, as it's saying the same thing?

Comment on lines +297 to +313
It's also possible to pass a from and until time for your schedule. For
example, if you want to execute a command every day at 13:00::

$from = new \DateTimeImmutable('13:00', new \DateTimeZone('Europe/Paris'));
RecurringMessage::every('1 day', new Message(), from: $from);

Or if you want to execute a message every day until a specific date::

$until = '2023-06-12';
RecurringMessage::every('1 day', new Message(), until: $until);

And you can even combine the from and until parameters for more granular
control::

$from = new \DateTimeImmutable('2023-01-01 13:47', new \DateTimeZone('Europe/Paris'));
$until = '2023-06-12';
RecurringMessage::every('first Monday of next month', new Message(), from: $from, until: $until);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tend to favor "documentation in code examples" over normal text. So I would suggest merging this into one code block and adding a couple inline comments, like:

// execute a message every day at 13:00
$from = new \DateTimeImmutable('13:00', new \DateTimeZone('Europe/Paris'));
RecurringMessage::every('1 day', new Message(), from: $from);

// execute a message every day until a specific date
$until = '2023-06-12';
RecurringMessage::every('1 day', new Message(), until: $until);

// ... etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants