Skip to content

Conversation

ankurk91
Copy link
Contributor

@ankurk91 ankurk91 commented Jan 25, 2023

Fixes the bug #45781

The dispatch method inside DispatchesJobs trait does not check for Unique Jobs.

The global dispatch helper functions does check it here

return (new UniqueLock(Container::getInstance()->make(Cache::class)))

This PR make these 2 methods act same.

@driesvints
Copy link
Member

This is a big change in behavior as you're now using the job itself to dispatch and not the dispatcher.

@ankurk91
Copy link
Contributor Author

ankurk91 commented Jan 25, 2023

@driesvints

The global helper method is not using the Dispatcher already.
and The PendingDispatch class is using the Dispatcher internally.
The only difference is to check for Unique jobs.

If you don't like this big change then,
The the dispatch method available to all Controllers via DispatchesJobs Trait must be renamed to forceDispatch() instead.

PS.
Laravel is known for DX and developer happiness. :)
This big change can save several debugging hours.

I would like to hear from other Laravel Team members.

@taylorotwell taylorotwell merged commit 5f61fd1 into laravel:10.x Jan 25, 2023
@taylorotwell
Copy link
Member

Fine with this change but IMO we should probably just remove this trait from the base controller in Laravel 10. It isn't necessary at all.

@ankurk91
Copy link
Contributor Author

Thanks Taylor,❤️
i will send a PR for the same

@driesvints
Copy link
Member

Thanks @ankurk91

@browner12
Copy link
Contributor

For reference: laravel/laravel@f62d260

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.

4 participants