queue umstellen
This commit is contained in:
parent
d99ec99fea
commit
d0b1141648
|
|
@ -18,20 +18,12 @@ class SendTeamsActivityNotificationJob implements ShouldQueue
|
||||||
use InteractsWithQueue;
|
use InteractsWithQueue;
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
/**
|
public string $queue = 'teams';
|
||||||
* Wie oft darf der Job retryen?
|
|
||||||
*/
|
|
||||||
public int $tries = 5;
|
public int $tries = 5;
|
||||||
|
|
||||||
/**
|
|
||||||
* Backoff in Sekunden (gestaffelt).
|
|
||||||
*/
|
|
||||||
public array $backoff = [10, 30, 60, 120, 300];
|
public array $backoff = [10, 30, 60, 120, 300];
|
||||||
|
|
||||||
/**
|
|
||||||
* Hard timeout für den Worker (Sekunden).
|
|
||||||
*/
|
|
||||||
public int $timeout = 30;
|
public int $timeout = 30;
|
||||||
|
public int $maxExceptions = 3;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected User $user,
|
protected User $user,
|
||||||
|
|
@ -44,15 +36,17 @@ class SendTeamsActivityNotificationJob implements ShouldQueue
|
||||||
try {
|
try {
|
||||||
$notifier->notify($this->user, $this->blueprint);
|
$notifier->notify($this->user, $this->blueprint);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
// Loggen für Diagnose; danach rethrow -> Queue retry
|
$logger->error('Teams activity notification failed', [
|
||||||
$logger->error('Teams activity notification job failed', [
|
|
||||||
'extension' => 'sbp-jm/flarum-msteams-webhook',
|
'extension' => 'sbp-jm/flarum-msteams-webhook',
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'notification_type' => $this->blueprint::getType(),
|
'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;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,14 @@ class TeamsNotificationDriver implements NotificationDriverInterface
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// notify_<type>_teams
|
|
||||||
$prefKey = User::getNotificationPreferenceKey($type, 'teams');
|
$prefKey = User::getNotificationPreferenceKey($type, 'teams');
|
||||||
|
|
||||||
if (! $user->getPreference($prefKey)) {
|
if (! $user->getPreference($prefKey)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Queue wie bei Driver-Konzept vorgesehen
|
// ✅ explizit auf Queue "teams"
|
||||||
$this->queue->push(new SendTeamsActivityNotificationJob($user, $blueprint));
|
$this->queue->pushOn('teams', new SendTeamsActivityNotificationJob($user, $blueprint));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue