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
Interesting package, @itsemon245. Looking through the repository and documentation, I have a few comments and some feedback. Take them for what they are and feel free to discard them.
Since campaign emails will likely to be processed by the queue using a job we can no longer pause the queue or the jobs for this specific campaign because they have already been dispatched.
Given the use case described, Laravel’s built-in Job Batching could provide a solid foundation to build upon. Batching is typically the preferred approach for scenarios like this. While batches support cancellation, they currently lack a pause functionality.
$batch->pause(); // Call to undefined method
Tying the state to a batch instead of an Eloquent model would allow for greater flexibility in package usage. You can avoid the $this->setPausedBy inside the job, and still allow for easily pausing the batch from inside the job:
/** * Execute the job. */publicfunctionhandle(): void
{
$this->batch()->pause();
}
In order to retrieve a batch instance you may query the Laravel command bus after creation. Pausing after dispatch would be as straight forward as:
I'll leave the decision and implementation to you. If you want to experiment with making any job pausable, take a look at laravel/framework#46163 (comment). Remaining explicit with the Pausable trait may be better though.
See laravel/ideas#735 if you haven't already. Good luck with your first Laravel package!
The text was updated successfully, but these errors were encountered:
The original idea behind this package solely revolves around the polymorphic relationship based on the use cases I had at that time.The idea of using the batch to pause sounds more efficient specially because I don't have to bother with attaching any model anymore.
And I didn't know there was a proposal this far back. Seems like the laravel team haven't really bought into the idea.
I will take your advice and hopefully come up with a sane implementation.
Interesting package, @itsemon245. Looking through the repository and documentation, I have a few comments and some feedback. Take them for what they are and feel free to discard them.
Given the use case described, Laravel’s built-in Job Batching could provide a solid foundation to build upon. Batching is typically the preferred approach for scenarios like this. While batches support cancellation, they currently lack a pause functionality.
Tying the state to a batch instead of an Eloquent model would allow for greater flexibility in package usage. You can avoid the
$this->setPausedBy
inside the job, and still allow for easily pausing the batch from inside the job:In order to retrieve a batch instance you may query the Laravel command bus after creation. Pausing after dispatch would be as straight forward as:
I'll leave the decision and implementation to you. If you want to experiment with making any job pausable, take a look at laravel/framework#46163 (comment). Remaining explicit with the
Pausable
trait may be better though.See laravel/ideas#735 if you haven't already. Good luck with your first Laravel package!
The text was updated successfully, but these errors were encountered: