Here's yet another example of how I got burned when my local dev environment didn't match my prod environment. Sync queues work differently than other queue types.
masteringlaravel.io/daily/2024-08-06-sync-queue-works-differently-than-async
Actually, the tip should be not to serialize models in asynchronous queues.
Takes up to much memory with Redis.
Serialization isn't 100% accurate here since Laravel only stores Eloquent model IDs and re-hydrates from the database. But the problem is the same: you lose access to in-memory change state.
It does do that? I remember it differently. It was i believe Mohammed Said (Mr. Queues) who suggested to only pass the ID of the model and never serialize the model in a job.
You'd rather have job middleware or some method in your job that checks, if you still need to handle the job
Yes, Laravel handles it for you with the `SerializesModels` trait. Very handy!
look at that, and i naively thought serialization means transforming the object to a string representation and vice versa.
TIL! Thank you for enlighten me