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

V1 no send no retry #248

Merged
merged 22 commits into from
Jun 9, 2016
Merged

V1 no send no retry #248

merged 22 commits into from
Jun 9, 2016

Conversation

hypesystem
Copy link
Collaborator

Note: this merges into v1 #238

This refactors the sender code a whole bunch, and removes the previously exposed sendNoRetry method. The same effect can now be achieved with send(msg, recipient, { retries: 0 }, callback).

This required some major changes to how the tests are structured, as I didnt want to be listening on what used to be "sendNoRetry".
requestStub is now a sinon spy.
it is reset before EVERY test (woops, before we only cleared state before each test CATEGORY)
and how we expect some things has changed as a result of these structural changes
They used the registration_ids key, which we will no longer support.
They passed because state was NOT reset before every test (fixed this in earlier commit)
@eladnava
Copy link
Collaborator

eladnava commented Jun 9, 2016

@hypesystem excellent work!

Tested it and works fine.

One minor thing, the package doesn't detect an invalid registration token currently if GCM returned InvalidRegistration for it, the package only checks for Unavailable:

if (results[i].error === 'Unavailable') {

Is this intentional? All tests pass, by the way. Merge when ready.

@hypesystem
Copy link
Collaborator Author

This is not something I have made a deliberate choice about now. It is how it was before...

I think the reasoning is that only unavailable registration tokens should be retried --- if the registration token is invalid, there is no need to retry. In the returned result, the invalid registration ids should still be present 😄 we don't have a test for it, but I definitely think we could add one. I might do that later !

@eladnava
Copy link
Collaborator

eladnava commented Jun 9, 2016

@hypesystem I'm thinking the package shouldn't be retrying an InvalidRegistration, but returning it within the array of registration tokens that are no longer valid and need to be removed by the developer.

@hypesystem
Copy link
Collaborator Author

Absolutely! That's basically under the point of #238 that is about better responses 😄 gonna merge this now and will look at the responses later

@hypesystem hypesystem merged commit 7286a4b into v1 Jun 9, 2016
@govardhanaraoganji
Copy link

@hypesystem and @eladnava have doubt, what is the use of retries, because of the retries param we are continuously hitting the server and some delay in response.

what we are going to achieve with retries ?

@eladnava
Copy link
Collaborator

eladnava commented Jun 9, 2016

@govardhanraoganji the GCM endpoint is bound to fail sometimes (due to an internal server error, for example) and so the GCM request should be retried in this scenario as it will likely succeed next time.

We do not retry a request that has failed due to user error, e.g. bad authentication, bad registration token, etc.

@hypesystem
Copy link
Collaborator Author

@govardhanraoganji we also retry the message for any registration tokens for which it was not delivered. Just in case it was a momentary outage.

@govardhanaraoganji
Copy link

@eladnava and @hypesystem thank you guys, your support was un countable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants