You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a job that is Batchable I normally check if the parent batch is cancelled or not before running any logic:
if (!$this->batch()?->cancelled()) {
return;
}
But if I wanted to access the batch again, that would mean the implementation(eg database) would have to retrieve the batch again. Perhaps this can be memoized? I understand the job might be released back to the queue and re-serialised so that would have to get accounted for.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
On a job that is
Batchable
I normally check if the parent batch is cancelled or not before running any logic:But if I wanted to access the batch again, that would mean the implementation(eg database) would have to retrieve the batch again. Perhaps this can be memoized? I understand the job might be released back to the queue and re-serialised so that would have to get accounted for.
framework/src/Illuminate/Bus/Batchable.php
Lines 31 to 40 in 4247b59
The alternative obviously is:
$batch = $this->batch()
Beta Was this translation helpful? Give feedback.
All reactions