Laravel Defibrillator is a bundle by Michael Dyrynda that can help you be certain that aspects of your application must be operating routinely are executing so.
📣 I *genuinely* went off the deep stop and now existing to you Laravel Defibrillator – a tiny bundle to enable your application jobs retain a ordinary rhythm.
Reduce your jobs from mind-boggling your databases, queue employees, mail supplier, and additional!https://t.co/7yIqUuyFV8
— Michael Dyrynda 💉💉 (@michaeldyrynda) September 6, 2021
This package can enable by delaying the including of careers to overwhelmed queue personnel although they capture up on a backlog of queue employment, for instance:
Take into account a scheduled process that communicates with your software end users on a common interval. This scheduled process queues notifications to your users centered on some problem in just your application. In a ordinary scenario, there is a handful of notifications to go out, and they are dispatched with in a handful of seconds. But an application mistake will cause your software to spiral out of regulate. Queued notifications back again up, your databases is not currently being up to date to flag notifications as having been sent, your mistake tracker floods with exceptions.
And then your scheduled task operates again.
Suddenly your queue has tens of thousands of pending jobs in it and you might be caught in a cycle that you can not preserve up with.
Here’s an case in point from the readme of how you may use this trait to continue to keep an regular rhythm:
5public purpose deal with()
7 if ($this->hasAbnormalRhythm())
13 // Frequent processing
You can also reduce lagging notifications from staying despatched if the heartbeat enters an irregular rhythm:
2public purpose shouldSend(): bool
4 return Cache::get('NotifyUsers')?->isFuture() ?? untrue
This offer has reasonable defaults for an interval involving ordinary rhythms, which are customizable when working with the package’s
3general public purpose interval(): int
5 return 30
You can understand extra about this deal, get complete set up directions, and see the source code on GitHub.