How to use transaction inside Job OR how to rollback model write operation inside job when it runs out of memory. #37357
-
Hi, I have a job which process below operations:
At point 2. it runs out of memory and process get killed. Currently I am doing this:
If no memory leak then everything works fine, if memory leak happened at operation 2 then I can not know it and rollback the model ($model->rollback()). How to achieve this? Currently it is just leaving open transactions as they are not committed when memory leak happened. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Unfortunately, that's out of the scope of transactions as PHP is terminated due to the memory leak. |
Beta Was this translation helpful? Give feedback.
-
Any one looking for solution, can use this in job handle method:
hope laravel will come up with nice way of handling this to get caught in the failed method. |
Beta Was this translation helpful? Give feedback.
Any one looking for solution, can use this in job handle method:
hope laravel will come up with nice way of handling this to get caught in the failed method.