Some way to bulk dispatch events after queued job finish executes #54022
Unanswered
sts-ryan-holton
asked this question in
Ideas
Replies: 1 comment 6 replies
-
Laravel 11 has https://laravel.com/docs/11.x/helpers#deferred-functions |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋
I'm not sure whether this functionality already exists, but I think it would be quite useful. My Laravel application contains a lot of queued jobs. Jobs by definition are essentially a way to run intensive logic at a later point in time without affecting the request lifecycle.
My job though contains various queued event listeners that are dispatched from it, each containing different types of data, I'll attach a slim version of what I mean.
Rather than actually dispatching these events at the point in time, it would be great if Laravel could essentially mock the
dispatch
in someway, obtain it's data in memory and then somehow dispatch them after the job finishes?Here's a slimed version of my job illustrating what I mean by dispatching events from the job
Maybe some new method or some new job functionality that holds things until job completion and then dispatches them?
Why am I proposing this?
Simply, my application is dispatching a tonne of events, and without refactoring the whole thing, I'd like to speed up the class execution and dispatch at the very end!
Would be great to get other thoughts on this!
Beta Was this translation helpful? Give feedback.
All reactions