Closed mzur closed 11 months ago
Maybe I don't get what you want to say but Events/Dispatchable does not contain a method called "dispatchNow".
That's right, I just assumed it was there (from the queued job dispatachable). But I think you found the ideal solution with ShouldBroadcastNow
.
The "succeeded" and "failed" events of an object tracking job are sent asynchronously via their own queue jobs:
https://github.com/biigle/core/blob/ac2f57f98b791eed61f8e71bd0f8994b7ddad141/app/Jobs/TrackObject.php#L106-L110
While the TrackObject job itself is processed by a configurable queue (e.g. with a higher priority), the events are pushed to the regular queue. With a busy queue, this could mean that the events are sent (and the user is notified) much later than the job actually finished. Fix this by dispatching the events with
dispatchNow
. It will send the events right from within the TrackObject job.