Add retry mechanism to email mailables and update supervisor config

This commit is contained in:
Víctor Falcón 2025-12-18 15:38:04 +01:00
parent 3d0d6c8bef
commit 2662c1f873
7 changed files with 95 additions and 1 deletions

View File

@ -15,6 +15,20 @@ class FeedbackEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The number of seconds to wait before retrying the job.
*
* @var array<int, int>
*/
public $backoff = [2, 5, 10, 30];
public function __construct(public User $user)
{
$this->onQueue('emails');

View File

@ -15,6 +15,20 @@ class ImportHelpEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The number of seconds to wait before retrying the job.
*
* @var array<int, int>
*/
public $backoff = [2, 5, 10, 30];
public function __construct(public User $user)
{
$this->onQueue('emails');

View File

@ -15,6 +15,20 @@ class OnboardingReminderEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The number of seconds to wait before retrying the job.
*
* @var array<int, int>
*/
public $backoff = [2, 5, 10, 30];
public function __construct(public User $user)
{
$this->onQueue('emails');

View File

@ -15,6 +15,20 @@ class PromoCodeEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The number of seconds to wait before retrying the job.
*
* @var array<int, int>
*/
public $backoff = [2, 5, 10, 30];
public function __construct(public User $user)
{
$this->onQueue('emails');

View File

@ -15,6 +15,20 @@ class WelcomeEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The number of seconds to wait before retrying the job.
*
* @var array<int, int>
*/
public $backoff = [2, 5, 10, 30];
public function __construct(public User $user)
{
$this->onQueue('emails');

View File

@ -15,6 +15,20 @@ class UserLeadInvitation extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The number of seconds to wait before retrying the job.
*
* @var array<int, int>
*/
public $backoff = [2, 5, 10, 30];
/**
* Create a new message instance.
*/

View File

@ -54,9 +54,19 @@ autorestart=true
stderr_logfile=/var/log/worker-inertia-ssr.log
stdout_logfile=/var/log/worker-inertia-ssr.log
[program:queue-worker-emails]
process_name=%(program_name)s
command=php /app/artisan queue:work database --queue=emails --sleep=1 --tries=5 --max-time=3600
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/queue-worker-emails.log
stopwaitsecs=3600
numprocs=1
[program:queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /app/artisan queue:work database --queue=emails,default --sleep=3 --tries=3 --max-time=3600
command=php /app/artisan queue:work database --queue=default --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
redirect_stderr=true