Skip to content

[Scheduler] Add new component documentation #18290

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

Closed
wants to merge 3 commits into from

Conversation

andreybolonin
Copy link
Contributor

@andreybolonin andreybolonin commented May 7, 2023

Fixes #18067, #18255, #18251

Based on #18136

Waiting for feedbacks and ready to fix some issues :)


.. code-block:: terminal

$ php bin/console messenger:consume scheduler_trial
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do scheduler_trial comes from?

Copy link
Member

@alexandre-daubois alexandre-daubois left a comment

Choose a reason for hiding this comment

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

Great to see this component being documented! 😃

RecurringMessage::every('first day of month', $msg);
RecurringMessage::every('next tuesday', $msg);

It is possible to specify an exact hour to trigger the schedule with `from`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
It is possible to specify an exact hour to trigger the schedule with `from`
It is possible to specify an exact hour to trigger the schedule with ``from``

$from = new \DateTimeImmutable('13:47', new \DateTimeZone('Europe/Paris'));
RecurringMessage::every('first day of month', $msg, from: $from);

If your schedule does not need to run indefinitely, you can use the `until` option
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If your schedule does not need to run indefinitely, you can use the `until` option
If your schedule does not need to run indefinitely, you can use the ``until`` option


.. note::

The minimal interval allowed with cron is 1 minute.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The minimal interval allowed with cron is 1 minute.
The minimal interval allowed by the ``cron()`` method is 1 minute.

}
}

Run the Messenger consumer
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Run the Messenger consumer
Run The Messenger Consumer


$ php bin/console messenger:consume scheduler_trial

Trigger your schedule
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Trigger your schedule
Trigger Your Schedule

The minimal interval allowed with cron is 1 minute.

Hashed expressions
~~~~
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
~~~~
~~~~~~~~~~~~~~~~~~

Comment on lines +134 to +138
* `#yearly`, `#annually` - Run once a year, midnight, Jan. 1 - `0 0 1 1 *`
* `#monthly` - Run once a month, midnight, first of month - `0 0 1 * *`
* `#weekly` - Run once a week, midnight on Sun - `0 0 * * 0`
* `#daily`, `#midnight` - Run once a day, midnight - `0 0 * * *`
* `#hourly` - Run once an hour, first minute - `0 * * * *`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* `#yearly`, `#annually` - Run once a year, midnight, Jan. 1 - `0 0 1 1 *`
* `#monthly` - Run once a month, midnight, first of month - `0 0 1 * *`
* `#weekly` - Run once a week, midnight on Sun - `0 0 * * 0`
* `#daily`, `#midnight` - Run once a day, midnight - `0 0 * * *`
* `#hourly` - Run once an hour, first minute - `0 * * * *`
* ``#yearly``, ``#annually`` - Run once a year, midnight, Jan. 1 - ``0 0 1 1 *``
* ``#monthly`` - Run once a month, midnight, first of month - ``0 0 1 * *``
* ``#weekly`` - Run once a week, midnight on Sun - ``0 0 * * 0``
* ``#daily``, ``#midnight`` - Run once a day, midnight - ``0 0 * * *``
* ``#hourly`` - Run once an hour, first minute - ``0 * * * *``

* `#hourly` - Run once an hour, first minute - `0 * * * *`

Message generator
~~~~
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
~~~~
~~~~~~~~~~~~~~~~~


You can also use some another triggers: ``CallbackTrigger, CronExpressionTrigger, DateIntervalTrigger, DatePeriodTrigger, ExcludeTimeTrigger``

Define your own trigger
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Define your own trigger
Define Your Own Trigger

~~~~~~~~~~~~~~~~~~~~~~~

By implementing the TriggerInterface, you can create your own trigger using
``getNextRunDate`` method::
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
``getNextRunDate`` method::
the :method:`FQCN\TriggerInterface::getNextRunDate` method::

@OskarStark
Copy link
Contributor

@kbond maybe you can find some spare time and review this PR, so we can merge this as a first version. Thanks

@javiereguiluz
Copy link
Member

Please, let's not work on this PR anymore for now.

It's not bad 🙏 but we're discussing internally about a radically different approach for the docs of this component. Same comment for the #17964 PR about Webhook/RemoteEvent docs.

I'm sorry but I hope you understand this. Thanks!

@Aerendir
Copy link
Contributor

@javiereguiluz , please, can you give us more details? I'm so curious! 😋

javiereguiluz added a commit that referenced this pull request Jan 17, 2024
…luz)

This PR was merged into the 6.3 branch.

Discussion
----------

[Scheduler] Document hashed cron expressions

Fixes #18255.

I took the list of expressions from the PR #18290 created by `@andreybolonin`

Commits
-------

0213c09 [Scheduler] Document hashed cron expressions
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.

7 participants