Skip to content

Commit b325d9e

Browse files
committed
update coold down to one hour before restarting.
1 parent f2dad3b commit b325d9e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/Console/Commands/ListenerPanoptesPusherCommand.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,13 @@ private function handleError(string $message, ?\Throwable $e = null, array $cont
630630

631631
private function handleCriticalError(string $message, \Throwable $e): void
632632
{
633+
// Do not send ANY critical emails if we are in a quota cooldown
634+
if (Cache::has('panoptes_listener_quota_cooldown')) {
635+
$this->error("Suppressed critical email during quota cooldown: {$message}");
636+
637+
return;
638+
}
639+
633640
$context = [
634641
'timestamp' => now()->toISOString(),
635642
'command' => 'panoptes:listen',
@@ -679,6 +686,11 @@ private function shouldSendEmailNotification(string $message): bool
679686
*/
680687
private function shouldSendCriticalEmail(): bool
681688
{
689+
// Double check quota cooldown here as well
690+
if (Cache::has('panoptes_listener_quota_cooldown')) {
691+
return false;
692+
}
693+
682694
$key = 'panoptes_listener_critical_email_sent';
683695
$lastSent = Cache::get($key, 0);
684696
$now = time();

0 commit comments

Comments
 (0)