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.
The current implementation of the
pulse:check
command is based on our earlier version of Pulse. Due to this, there is a lot of things that feel clunky and don't work as reliably as they could.This PR rethinks the command and also how recorders that interact with the shared beats can work.
It also allows the command to run a single time when run within a Laravel Vapor's scheduler.
Improvements
Recorders previously had to do some modulus math if they only wanted to record every now an then. The timeframes were limited to 5 second increments. For example, if we wanted our recorder to take a snapshot every 15 seconds we would do the following...
You now may use the much more reliable
Throttling
concern, that ships with Pulse, to throttle recording to a max of every 15 seconds. The throttled duration can now be any arbitrary interval, although the beat will only be triggered roughly once per second.This makes recording on any given interval much more reliable than it was previously, which could miss intervals if listeners took too long.
For shared beats this will throttle to the current server. For isolated beats this will throttle across servers.
Implementation notes
lastSnapshotAt
has been removed. This was not always accurate, and sometimes it was simply a lie. For example, the first time you run the command it will tell you it was run5
seconds ago, which it was not.