Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[11.x] Name of job set by displayName() must be honoured by Schedule #50973

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

SCIF
Copy link
Contributor

@SCIF SCIF commented Apr 8, 2024

Queue jobs could have displayName() method providing a better naming than just a plain classname. This name is currently honoured by a queue worker but a queue scheduler. This PR fixes this inconsistency

@SCIF
Copy link
Contributor Author

SCIF commented Apr 8, 2024

This is the version of #50961 without BC brake.

@taylorotwell taylorotwell merged commit d63d2b1 into laravel:11.x Apr 9, 2024
28 checks passed
@SanderMuller
Copy link
Contributor

@SCIF you could update the code to only use the displayName() method when the job() method already receives an instance. This prevents creating an instance for calls that explicitly pass the class string (potentially doing this avoid creating an instance)

$name = !is_string($job) && method_exists($job, 'displayName')
    ? $job->displayName()
    : get_class($job);

@SCIF
Copy link
Contributor Author

SCIF commented Apr 12, 2024

@SanderMuller , thank for spotting this! I took the creation of the object out of the callback which is a bad idea. Will prepare a fix soon, including tests changed.

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

Successfully merging this pull request may close these issues.

None yet

3 participants