Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a specific log for "Quotas exceeded" #105

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions core/class/mobile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,15 @@ public static function notification($arn, $os, $titre, $message, $type, $idNotif
sleep(rand(1,10));
$result = json_decode($request_http->exec(30,3), true);
}
log::add('mobile', 'debug', '|└────────────────────');
if (!isset($result['state']) || $result['state'] != 'ok') {
throw new Exception(__('Echec de l\'envoi de la notification :', __FILE__) . json_encode($result));
if (isset($result['error']) && strpos($result['error'], 'Quotas exceeded') !== false) {
log::add('mobile', 'error', __("Les quotas pour fcm sont dépassés. Le maximum autorisé est de 5 requêtes par minute.", __FILE__));
log::add('mobile', 'debug', __('Echec de l\'envoi de la notification :', __FILE__) . json_encode($result));
} else {
throw new Exception(__('Echec de l\'envoi de la notification :', __FILE__) . json_encode($result));
}
}
log::add('mobile', 'debug', '|└────────────────────');
}

public function SaveGeoloc($geoloc)
Expand Down