khaleader
khaleader

Reputation: 183

Laravel jobs table keeps queues undeleted after doing the job

I'm using database queue driver of Laravel to send email in a production server (laravel forge digitalocean), the email is sent normally but the problem the queues stayed stored in the jobs table and the number increases and keeps attempting to 255
and I did in the listener class

if ($this->attempts() > 10) {
    $this->delete();
}

And nothing gets deleted. How do I remove them after the email is sent?

Upvotes: 1

Views: 1267

Answers (2)

Sari Yono
Sari Yono

Reputation: 577

this is from the laravel docs

public function handle(SendEmail $command)
{ 
    if (true)
    {
        $this->release(30);
    }
}

Upvotes: 1

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111839

You need to run

$this->delete();

always when job is done and not only when attempts number is greater than 10

Upvotes: 1

Related Questions