Description: I have several servers on which job is performing search to receive results. When I add new server to database I need to perform search for each existing user. Every search is a single job. I decided to use Laravel's batch to group these jobs. Code looks like this:
function serverAdded() {
$batch = Bus::batch([])
->allowFailures()
->catch(function() { ... })
->then(function() { ... })
->dispatch();
$users = User::lazy();
foreach ($users as $user) {
$batch->add(new SeearchJob($user));
}
}
Problem: The problem is that sometimes 1 job (always the last one) stays in pending state as shown in the attached picture. In logs from job I can see that job is executed correctly. If searching goes wrong I mark job as failed and retrying all failed jobs, but this job is neither finished or failed...
Any ideas?
