[12.x] Make method repeatEvery
public in Sub-Minute Scheduled Tasks
#50841
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now there is no way to use full power of Sub-Minute Scheduled Tasks because
repeatEvery
method is protected and you can't set task to repeat every 3, 4, 6, 12 seconds. Moreover you can't pass dynamic number of seconds to schedule task.My use case: I need to request some API every 3 seconds so
everyTwoSeconds
is too often andeveryFiveSeconds
is too rarely.Although
repeatSeconds
property is public so we can do:Which is obviously not a Laravel way to do things. Now only this methods are available:
After this change we can call:
Target is master because this is breaking change if someone inherits
Illuminate/Console/Scheduling/Event
class.