Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

feat: Use FCM HTTPv1 protocol with twisted async #1308

Merged
merged 4 commits into from
Dec 22, 2018
Merged

Conversation

jrconlin
Copy link
Member

With the coming switch to FCM, it makes sense to also switch to the new
FCM HTTPv1 protocol.

Closes #1291

With the coming switch to FCM, it makes sense to also switch to the new
FCM HTTPv1 protocol.

Closes #1291
@codecov-io
Copy link

codecov-io commented Dec 13, 2018

Codecov Report

Merging #1308 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
autopush/router/fcm.py 100% <ø> (ø) ⬆️
autopush/tests/test_router.py 100% <100%> (ø) ⬆️
autopush/router/__init__.py 100% <100%> (ø) ⬆️
autopush/router/fcm_v1.py 100% <100%> (ø)
autopush/router/adm.py 100% <100%> (ø) ⬆️
autopush/tests/test_z_main.py 100% <100%> (ø) ⬆️
autopush/constants.py 100% <100%> (ø) ⬆️
autopush/router/fcmv1client.py 100% <100%> (ø)
autopush/config.py 99.02% <100%> (+0.02%) ⬆️
autopush/router/gcm.py 100% <100%> (ø) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c02528f...bc09c1e. Read the comment docs.

Copy link
Member

@pjenvey pjenvey left a 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

return d

def error(self, failure):
if isinstance(failure.value, FCMAuthenticationError) or \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
if isinstance(failure.value, FCMAuthenticationError) or \
if isinstance(failure.value, (FCMAuthenticationError, TimeoutError, ConnectError):

}
message = self._build_message(token, payload)
if 'timeout' not in self._options:
self._options['timeout'] = 3
Copy link
Member

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?)

Copy link
Member Author

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.

status=401,
uri=kwargs.get('uri'),
senderid=repr(senderid))
if not (senderid == self.senderID):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
if not (senderid == self.senderID):
if senderid != self.senderID:


def _process_reply(self, reply, notification, router_data, ttl):
"""Process FCM send reply"""
# acks:
Copy link
Member

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?)

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad comment, thanks!

pjenvey
pjenvey previously approved these changes Dec 21, 2018
@jrconlin jrconlin merged commit e185738 into master Dec 22, 2018
@jrconlin jrconlin deleted the feat/1291-fcm branch December 22, 2018 00:56
@jrconlin jrconlin mentioned this pull request Jan 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants