Skip to content

[10.x] Give access to job UUID in the job queued event #48179

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
Aug 25, 2023

Conversation

timacdonald
Copy link
Member

@timacdonald timacdonald commented Aug 25, 2023

The JobQueued event is dispatched whenever a job has been pushed to the queue (although, not for "bulk" jobs).

The JobQueued event does expose the database's record ID, however this ID changes if a job fails and is retried.

Currently the jobs "sticky" ID - which is held in the payload - is not available.

The job's payload ID is sticky because it does not change when a job fails and is retried - however the database ID does change.

This change makes tracking the job from queued through all it's lifecycle hooks much easier. Without it...it's pretty much impossible.

* @return void
*/
protected function raiseJobQueuedEvent($jobId, $job)
protected function raiseJobQueuedEvent($jobId, $job, $payload)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a breaking change, however I'm not sure if we expect anyone to override it.

If we are concerned about this, we use magic and just access it via func_get_args() but not have it in the method signature. We have done this before in the framework.

timacdonald and others added 2 commits August 25, 2023 18:07
Co-authored-by: Dries Vints <dries@vints.io>
Co-authored-by: Dries Vints <dries@vints.io>
@timacdonald
Copy link
Member Author

Thanks, @driesvints

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants