-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Use FCM HTTPv1 protocol with twisted async #1308
Conversation
With the coming switch to FCM, it makes sense to also switch to the new FCM HTTPv1 protocol. Closes #1291
Codecov Report
@@ Coverage Diff @@
## master #1308 +/- ##
==========================================
+ Coverage 99.79% 99.81% +0.01%
==========================================
Files 61 64 +3
Lines 9948 10673 +725
==========================================
+ Hits 9928 10653 +725
Misses 20 20
Continue to review full report at Codecov.
|
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.
sorry for the lag
autopush/router/fcmv1client.py
Outdated
return d | ||
|
||
def error(self, failure): | ||
if isinstance(failure.value, FCMAuthenticationError) or \ |
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.
nit
if isinstance(failure.value, FCMAuthenticationError) or \ | |
if isinstance(failure.value, (FCMAuthenticationError, TimeoutError, ConnectError): |
autopush/router/fcmv1client.py
Outdated
} | ||
message = self._build_message(token, payload) | ||
if 'timeout' not in self._options: | ||
self._options['timeout'] = 3 |
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.
gcmclient also defaults to 3 but then gcm.py overwrites it with its own default of 10 (should we set this to 10 somewhere as too?)
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.
Well, GCM is different, and the value is only set to 10 if it's not already present, so it's more a backup than anything else. That said, I should be better about having a "global base timeout" value.
autopush/router/fcm_v1.py
Outdated
status=401, | ||
uri=kwargs.get('uri'), | ||
senderid=repr(senderid)) | ||
if not (senderid == self.senderID): |
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.
nit
if not (senderid == self.senderID): | |
if senderid != self.senderID: |
autopush/router/fcm_v1.py
Outdated
|
||
def _process_reply(self, reply, notification, router_data, ttl): | ||
"""Process FCM send reply""" | ||
# acks: |
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.
this comment's outdated (left over from gcm.py?)
8ba0573
to
e4dc4f5
Compare
autopush/router/fcm_v1.py
Outdated
def route_notification(self, notification, uaid_data): | ||
"""Start the FCM notification routing, returns a deferred""" | ||
router_data = uaid_data["router_data"] | ||
# Kick the entire notification routing off to a thread |
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.
Thread?
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.
bad comment, thanks!
With the coming switch to FCM, it makes sense to also switch to the new
FCM HTTPv1 protocol.
Closes #1291