queue umstellen
This commit is contained in:
parent
d99ec99fea
commit
d0b1141648
|
|
@ -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,12 +36,14 @@ 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;
|
||||
|
|
|
|||
|
|
@ -26,15 +26,14 @@ class TeamsNotificationDriver implements NotificationDriverInterface
|
|||
continue;
|
||||
}
|
||||
|
||||
// notify_<type>_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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue