You can't tell me Laravel queues haven't bitten you at least once.
It's great that we get them out of the box, but man, they can be confusing as hell sometimes. Over the years, I've screwed up, more than once, and collected quite a few lessons along the way.
Claude is currently Pondering.., I'm waiting, and bored, so shall we?
Gotcha #1
I want you to look at the code below and tell me if you can spot anything wrong:
<?php
namespace App\Jobs;
use DateTime;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendAbandonedCartReminder implements ShouldQueue
{
use Queueable;
public function retryUntil(): DateTime
{
return now()->addMinutes(10);
}
public function handle(): void
{
// business logic
}
}
SendAbandonedCartReminder::dispatch($cart)->delay(now()->addDay());
Nothing sus, right? The customer left their cart, so we nudge them a day later. And if the mail prov
Discussion
Leave the first comment
Be the first to leave a mark on this discussion.