biigle / core

:large_blue_circle: Application core of BIIGLE
https://biigle.de
GNU General Public License v3.0
12 stars 16 forks source link

Make dispatching of object tracking events synchonous #615

Closed mzur closed 11 months ago

mzur commented 1 year ago

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.

lehecht commented 1 year ago

Maybe I don't get what you want to say but Events/Dispatchable does not contain a method called "dispatchNow".

mzur commented 11 months ago

That's right, I just assumed it was there (from the queued job dispatachable). But I think you found the ideal solution with ShouldBroadcastNow.