Laravel-Queue-Monitor
Laravel-Queue-Monitor copied to clipboard
Any thoughts on how this might be used to kill a running job?
This is probably a feature request but I haven't found any good info on this in the Laravel docs.
Is there a way to hook the "delete" action on a running job to kill the task itself or interrupt it?
Laravel does not include include any functionality like this out of the box. I've already implemented a similar functionality by storing the process ID in the queue data.
public function handle(): void
{
if (function_exists('posix_getpid')) {
$this->queueData(['process_id' => posix_getpid()]);
}
}
You could you posix_kill to kill the process.
I'll look into this further and setup a PR 👍