Repository navigation
[13.x] Decode job payload once - #61526
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
|
Think this could change the way jobs serialize in a way we don't want? |
|
@taylorotwell I don't think so, it's serialized as normal via This method is called in the worker loop, so this PR stops the worker constantly calling json_decode on the raw payload which doesnt change. RedisJob does this, but doesn't utilise it fully Double checked locally and the payload is the same Happy to send it to master if there's a concern but lmk if im missing something stupid Ty big dog |
|
Using the |
Update Job.php test
aad0ec8 to
6523a10
Compare
|
Thanks @timacdonald! Adjusted to now use ty all 🫡 |
I was poking and realised
payload()is called for figuring out all the job settings likemaxTries,retryUntiletc. In the Worker loop, but, it's decoded fresh each time.RedisJobalready decodes once into adecodedproperty, see #13952 but, of course not all the methods are called that way.I think this should just be the default.
This helps if you have larger payloads mainly, so for smaller jobs there's no real difference.
SQS supports up to 1 MiB, Database and Redis can take more, so after some basic testing with about 200kb - 900kb its about 20% - 30% faster to finish a job just with this one change, Which of course is more meaningful the more jobs you process.
This PR just once's it
Sent to 13.x as I don't see how a payload would be expected to give a a different string on the second call, but happy to send to 14.x if you prefer? or refactor?
We could clean up the Redis job in 14.x, but open to whats easier for you 🖖🏻