diff --git a/src/Job/SendTeamsActivityNotificationJob.php b/src/Job/SendTeamsActivityNotificationJob.php index e2870a0..f1e3246 100644 --- a/src/Job/SendTeamsActivityNotificationJob.php +++ b/src/Job/SendTeamsActivityNotificationJob.php @@ -18,20 +18,12 @@ class SendTeamsActivityNotificationJob implements ShouldQueue use InteractsWithQueue; use SerializesModels; - /** - * Wie oft darf der Job retryen? - */ + public string $queue = 'teams'; + public int $tries = 5; - - /** - * Backoff in Sekunden (gestaffelt). - */ public array $backoff = [10, 30, 60, 120, 300]; - - /** - * Hard timeout für den Worker (Sekunden). - */ public int $timeout = 30; + public int $maxExceptions = 3; public function __construct( protected User $user, @@ -44,15 +36,17 @@ class SendTeamsActivityNotificationJob implements ShouldQueue try { $notifier->notify($this->user, $this->blueprint); } catch (Throwable $e) { - // Loggen für Diagnose; danach rethrow -> Queue retry - $logger->error('Teams activity notification job failed', [ + $logger->error('Teams activity notification failed', [ 'extension' => 'sbp-jm/flarum-msteams-webhook', 'user_id' => $this->user->id, 'notification_type' => $this->blueprint::getType(), - 'exception' => $e, + 'queue' => $this->queue, + 'attempt' => method_exists($this, 'attempts') ? $this->attempts() : null, + 'exception_class' => get_class($e), + 'message' => $e->getMessage(), ]); throw $e; } } -} \ No newline at end of file +} diff --git a/src/Notification/TeamsNotificationDriver.php b/src/Notification/TeamsNotificationDriver.php index c2b3941..08e3ac6 100644 --- a/src/Notification/TeamsNotificationDriver.php +++ b/src/Notification/TeamsNotificationDriver.php @@ -26,15 +26,14 @@ class TeamsNotificationDriver implements NotificationDriverInterface continue; } - // notify__teams $prefKey = User::getNotificationPreferenceKey($type, 'teams'); if (! $user->getPreference($prefKey)) { continue; } - // Queue wie bei Driver-Konzept vorgesehen - $this->queue->push(new SendTeamsActivityNotificationJob($user, $blueprint)); + // ✅ explizit auf Queue "teams" + $this->queue->pushOn('teams', new SendTeamsActivityNotificationJob($user, $blueprint)); } }