0

I am using Laravel Horizon to handle queued jobs. Below is my code

<?php

namespace App\Jobs;

class ProcessPodcast implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $podcast;

    public function handle(AudioProcessor $processor)
    {
        // Process uploaded podcast...
        Log::channel('slack')->send('Processing ...');
    }
}

In the job handle method, I have logging to slack channel. When this type of queued jobs is executed, I got the slack msg.

Sometimes, I say 1% to 5%, when I dispatched job ProcessPodcast::dispatch(), I didn't get the slack message. And I didn't get the job showed up under Horizon Failed Job page. This behaviors is totally random. It is very hard to reproduce. I am thinking that:

Case #1: Laravel did not create the job, therefore, no job is executed

Case #2: Laravel created the job, but Horizon didn't run the job

In either case, it would be very helpful to check if a job ProcessPodcast is saved to Redis. I don't think this is possible with Redis.

Please provide recommendations on how to debug this issue.

Michael Nguyen
  • 1,691
  • 2
  • 18
  • 33
  • What worker are you running `php artisan queue work` or `php artisan horizon` ? – Clément Baconnier Jul 24 '19 at 07:06
  • php artisan horizon – Michael Nguyen Jul 24 '19 at 07:06
  • You can see if the jobs are stored in Redis with [Queue::size()](https://stackoverflow.com/a/48705481/8068675) – Clément Baconnier Jul 24 '19 at 07:12
  • Queue::size() just return the size of the queue. Horizon processes 300 to 400 jobs per minute and each job is `horizon:123` (123 is the id of the job). I have to go inside each job (in redis), and look inside the `ProcessPodcast`. It is impossible to do manually considered the number of jobs are queued per minute – Michael Nguyen Jul 24 '19 at 14:26
  • I see, with that amount of jobs it will be quit difficult to see if your jobs are stored. The only way I can think of is to monitor Redis `redis-cli monitor | grep -E ' "ProcessPodcast" '` I don't think it will help you much, but that's the only solution I have in mind to see if a job **is effectively** pushed on Redis – Clément Baconnier Jul 24 '19 at 15:33

0 Answers0