You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was merged into the 6.3 branch.
Discussion
----------
[Scheduler] add `JitterTrigger`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #49806
| License | MIT
| Doc PR | n/a
I think this is what `@vtsykun` was trying to accomplish with #49806. FreeBSD has a `-jitter` option that does the same thing so I think there's precedent. From the (https://man.freebsd.org/cgi/man.cgi?cron):
> -j jitter
> Enable time jitter. Prior to executing commands, cron will sleep
a random number of seconds in the range from 0 to jitter. ~This
will not affect superuser jobs (see -J).~ A value for jitter must
be between 0 and 60 inclusive. Default is 0, which effectively
disables time jitter.
> This option can help to smooth down system load spikes during mo-
ments when a lot of jobs are likely to start at once, e.g., at
the beginning of the first minute of each hour.
Usage:
```php
// defaults to 0-60 seconds
$schedule->add(RecurringMessage::cron('`@daily`', $message1)->withJitter());
// customize the max seconds (0-30)
$schedule->add(RecurringMessage::cron('`@daily`', $message1)->withJitter(30));
```
Commits
-------
b0d984b [Scheduler] add `JitterTrigger`
0 commit comments