fix: Email should be retried with backoff
This commit is contained in:
parent
a014bf1713
commit
dabda4e806
19 changed files with 58 additions and 136 deletions
|
|
@ -187,7 +187,7 @@ public function handle()
|
||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$this->mail = (new BackupSuccess($backup, $db))->toMail();
|
// $this->mail = (new BackupSuccess($backup->frequency, $db->name))->toMail();
|
||||||
$this->sendEmail();
|
$this->sendEmail();
|
||||||
break;
|
break;
|
||||||
// case 'invitation-link':
|
// case 'invitation-link':
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,12 @@ public function middleware(): array
|
||||||
return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
|
return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct(public Server $server) {}
|
public function __construct(public Server $server)
|
||||||
|
{
|
||||||
|
if (isDev()) {
|
||||||
|
$this->handle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,12 @@
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class DeploymentFailed extends Notification implements ShouldQueue
|
class DeploymentFailed extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public Application $application;
|
public Application $application;
|
||||||
|
|
||||||
public ?ApplicationPreview $preview = null;
|
public ?ApplicationPreview $preview = null;
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,12 @@
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class DeploymentSuccess extends Notification implements ShouldQueue
|
class DeploymentSuccess extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public Application $application;
|
public Application $application;
|
||||||
|
|
||||||
public ?ApplicationPreview $preview = null;
|
public ?ApplicationPreview $preview = null;
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,12 @@
|
||||||
namespace App\Notifications\Application;
|
namespace App\Notifications\Application;
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class StatusChanged extends Notification implements ShouldQueue
|
class StatusChanged extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public string $resource_name;
|
public string $resource_name;
|
||||||
|
|
||||||
public string $project_uuid;
|
public string $project_uuid;
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,12 @@
|
||||||
namespace App\Notifications\Container;
|
namespace App\Notifications\Container;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class ContainerRestarted extends Notification implements ShouldQueue
|
class ContainerRestarted extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct(public string $name, public Server $server, public ?string $url = null)
|
public function __construct(public string $name, public Server $server, public ?string $url = null)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,12 @@
|
||||||
namespace App\Notifications\Container;
|
namespace App\Notifications\Container;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class ContainerStopped extends Notification implements ShouldQueue
|
class ContainerStopped extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct(public string $name, public Server $server, public ?string $url = null)
|
public function __construct(public string $name, public Server $server, public ?string $url = null)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
18
app/Notifications/CustomEmailNotification.php
Normal file
18
app/Notifications/CustomEmailNotification.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class CustomEmailNotification extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
public $backoff = [10, 20, 30, 40, 50];
|
||||||
|
|
||||||
|
public $tries = 5;
|
||||||
|
|
||||||
|
public $maxExceptions = 5;
|
||||||
|
}
|
||||||
|
|
@ -3,20 +3,12 @@
|
||||||
namespace App\Notifications\Database;
|
namespace App\Notifications\Database;
|
||||||
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class BackupFailed extends Notification implements ShouldQueue
|
class BackupFailed extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $backoff = 10;
|
|
||||||
|
|
||||||
public $tries = 2;
|
|
||||||
|
|
||||||
public string $name;
|
public string $name;
|
||||||
|
|
||||||
public string $frequency;
|
public string $frequency;
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,12 @@
|
||||||
namespace App\Notifications\Database;
|
namespace App\Notifications\Database;
|
||||||
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class BackupSuccess extends Notification implements ShouldQueue
|
class BackupSuccess extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $backoff = 10;
|
|
||||||
|
|
||||||
public $tries = 3;
|
|
||||||
|
|
||||||
public string $name;
|
public string $name;
|
||||||
|
|
||||||
public string $frequency;
|
public string $frequency;
|
||||||
|
|
@ -24,6 +16,7 @@ class BackupSuccess extends Notification implements ShouldQueue
|
||||||
public function __construct(ScheduledDatabaseBackup $backup, public $database, public $database_name)
|
public function __construct(ScheduledDatabaseBackup $backup, public $database, public $database_name)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
||||||
$this->name = $database->name;
|
$this->name = $database->name;
|
||||||
$this->frequency = $backup->frequency;
|
$this->frequency = $backup->frequency;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,12 @@
|
||||||
namespace App\Notifications\ScheduledTask;
|
namespace App\Notifications\ScheduledTask;
|
||||||
|
|
||||||
use App\Models\ScheduledTask;
|
use App\Models\ScheduledTask;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class TaskFailed extends Notification implements ShouldQueue
|
class TaskFailed extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $backoff = 10;
|
|
||||||
|
|
||||||
public $tries = 2;
|
|
||||||
|
|
||||||
public ?string $url = null;
|
public ?string $url = null;
|
||||||
|
|
||||||
public function __construct(public ScheduledTask $task, public string $output)
|
public function __construct(public ScheduledTask $task, public string $output)
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,11 @@
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class DockerCleanup extends Notification implements ShouldQueue
|
class DockerCleanup extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct(public Server $server, public string $message)
|
public function __construct(public Server $server, public string $message)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,12 @@
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class ForceDisabled extends Notification implements ShouldQueue
|
class ForceDisabled extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct(public Server $server)
|
public function __construct(public Server $server)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,12 @@
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class ForceEnabled extends Notification implements ShouldQueue
|
class ForceEnabled extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct(public Server $server)
|
public function __construct(public Server $server)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,12 @@
|
||||||
namespace App\Notifications\Server;
|
namespace App\Notifications\Server;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class HighDiskUsage extends Notification implements ShouldQueue
|
class HighDiskUsage extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct(public Server $server, public int $disk_usage, public int $server_disk_usage_notification_threshold)
|
public function __construct(public Server $server, public int $disk_usage, public int $server_disk_usage_notification_threshold)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,12 @@
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class Reachable extends Notification implements ShouldQueue
|
class Reachable extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
protected bool $isRateLimited = false;
|
protected bool $isRateLimited = false;
|
||||||
|
|
||||||
public function __construct(public Server $server)
|
public function __construct(public Server $server)
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,12 @@
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class Unreachable extends Notification implements ShouldQueue
|
class Unreachable extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
protected bool $isRateLimited = false;
|
protected bool $isRateLimited = false;
|
||||||
|
|
||||||
public function __construct(public Server $server)
|
public function __construct(public Server $server)
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,11 @@
|
||||||
use App\Models\TeamInvitation;
|
use App\Models\TeamInvitation;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\Channels\TransactionalEmailChannel;
|
use App\Notifications\Channels\TransactionalEmailChannel;
|
||||||
use Illuminate\Bus\Queueable;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class InvitationLink extends Notification implements ShouldQueue
|
class InvitationLink extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 5;
|
|
||||||
|
|
||||||
public function via(): array
|
public function via(): array
|
||||||
{
|
{
|
||||||
return [TransactionalEmailChannel::class];
|
return [TransactionalEmailChannel::class];
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,11 @@
|
||||||
namespace App\Notifications\TransactionalEmails;
|
namespace App\Notifications\TransactionalEmails;
|
||||||
|
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use Illuminate\Bus\Queueable;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class Test extends Notification implements ShouldQueue
|
class Test extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $tries = 5;
|
|
||||||
|
|
||||||
public function __construct(public string $emails)
|
public function __construct(public string $emails)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue