Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5] Ability to determine if queued handler should be pushed to queue #19957

Merged
merged 3 commits into from
Jul 8, 2017
Merged

[5.5] Ability to determine if queued handler should be pushed to queue #19957

merged 3 commits into from
Jul 8, 2017

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Jul 7, 2017

An event that has multiple queued handlers, sometimes a single handler is only desired to run in a certain condition, normally you'd let the handler be queued and when workers run it you can just return null in handle() method if it shouldn't be run, but you end up with filling your queues with unnecessary jobs.

This PR adds the ability to add a shouldPushToQueue() on the handler class to determine if that queued handler should be pushed to queue or not:

public function shouldPushToQueue($event){
    return $event->user->shouldReceiveOffer();
}

@taylorotwell taylorotwell merged commit a2910f2 into laravel:master Jul 8, 2017
@taylorotwell
Copy link
Member

@themsaid can you PR a test for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants