Closed michaelnguyen2021 closed 4 years ago
Is the retryAfter
behavior in the job class perhaps what you‘re after?
@jeromegamez I ended up using
try {
app('firebase.messaging')->send($message);
} catch (NotFound $e) {
$this->device->delete();
} catch (ServerError $e) {
$this->release($this->attempts() * 10);
}
I have some weird issue with retryAfter
where the retryAfter time does not increment by the number of attempts.
This brings me to the next question: how to try and catch for all app('firebase.messaging')->send($message);
without copy and paste try/catch where I use app('firebase.messaging')->send($message);
You can catch the MessagingException
interface (https://github.com/kreait/firebase-php/blob/main/src/Firebase/Exception/MessagingException.php).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I usually have a queued job to process sending a push notification. When the job gets a
ServerError
orServerUnavailable
Exception, it will retry immediately until it runs out of the number of tries.Ideally, if the job gets the
ServerError
orServerUnavailable
. It should wait for 30s before trying again. I am not sure how to do this? Any suggestions?