0

I am running into an issue since I switched to Redis for the queue in Laravel. I am dispatching jobs, but they arent always being picked up in the queue. I am testing this by dispatching the job in Tinker with a separate command line running php artisan queue:work and I am noticing sometimes I have to dispatch the job two or three times before it is being picked up by the queue.

Here is the job I am dispatching:

namespace App\Jobs;

use App\Events\GameFunction;
use App\Events\GameUpdate;
use App\Http\Livewire\GolfGame;
use App\Models\Cards;
use App\Models\Games;
use App\Models\Scores;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use romanzipp\QueueMonitor\Traits\IsMonitored;

class BotPlay implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    use IsMonitored;

I am calling it in tinker like this BotPlay::dispatch($game); and getting Illuminate\Foundation\Bus\PendingDispatch as a response each time.

Is there something I need to do differently with Redis when dispatching the job?

Thanks!

Markwow
  • 141
  • 9

2 Answers2

0

Please check ...

Have you started queue worker?

if not then start it by running below artisan command

php artisan queue:work

Hope this will be helpful.

Rajen Trivedi
  • 1,225
  • 2
  • 5
  • 10
  • Hi Rajen, I have this running and that is how I can see that only 1 for every 3 is actually appearing in the queue. – Markwow Feb 09 '23 at 04:00
0

This was a mistake with my laravel setup and having two queues both picking up the jobs so they didn't always appear in the queue I was watching but were getting picked up in the other queue. With one queue it is working as expected.

Markwow
  • 141
  • 9