-
Notifications
You must be signed in to change notification settings - Fork 331
Added minimal support for sending FCM messages in async using HTTP/2 #870
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
Conversation
error_dict, message = _parse_platform_error(content, status_code) | ||
exc = None | ||
if handle_func: | ||
exc = handle_func(error, message, error_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed offline, let's confirm if this complex code path is necessary for error handling. If it is not, let's clean it up and keep it simple :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we use this map FCM specific errors like:
FCM_ERROR_TYPES = {
'APNS_AUTH_ERROR': ThirdPartyAuthError,
'QUOTA_EXCEEDED': QuotaExceededError,
'SENDER_ID_MISMATCH': SenderIdMismatchError,
'THIRD_PARTY_AUTH_ERROR': ThirdPartyAuthError,
'UNREGISTERED': UnregisteredError,
}
We map to these errors by parsing the error response details. The default handle_func
(handle_X_error
) is agnostic to the source service of the error and doesn't try to parse based the error response details. FCM is the only service that currently makes use of this optional handle_func
but this seems like the correct way to support this scenario.
We could move the logic from the helper function _handle_func_X
to handle_platform_error_from_X
.
Will merge as is and we can revisit this in a follow up PR if necessary.
pyjwt[crypto] >= 2.5.0 | ||
httpx[http2] == 0.28.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add this new dependency to setup.py
Adds basic logic for sending FCM messages in async using HTTP/2
This initial PR covers:
send_each_async()