Closed tklie closed 11 months ago
Hey there,
While this may be a legitimate issue, can you first try posting your problem or question on one of the support channels below? If this issue can be definitively identified as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.
Thanks!
Horizon Version
5.21.4
Laravel Version
10.37.1
PHP Version
8.2.13
Redis Driver
Predis
Redis Version
5.0.7
Database Driver & Version
No response
Description
I am registering a singleton to keep track of a model id. This singleton is again resolved and used throughout services in my application to add model scopes based on this id.
First, the singleton is resolved in the
handle()
method of my job and the id is set. During the processing of the job, everything works as expected. I am then using an event subscriber to listen for theJobProcessedEvent
and perform some post-job logic. In this subscriber, I also access the singleton. However, the singleton's state in the event subscriber sometimes does not match the state that was set by the job. I find this to be unexpected.Based on my understanding, the raising of the
JobProcessedEvent
and the execution of the listener follow the processing of the job immediately and synchronously, before the worker picks up a new job from the queue. As such, the singleton's state should not be able to change between job and listener (I included the Sentry stack trace that lead to this understanding at the end). Am I mistaken here?Steps To Reproduce
Stacktrace