Skip to content

Implementing retry once for FIS Client. #895

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

Merged
merged 9 commits into from
Oct 14, 2019
Merged

Implementing retry once for FIS Client. #895

merged 9 commits into from
Oct 14, 2019

Conversation

ankitaj224
Copy link
Contributor

No description provided.

@ankitaj224 ankitaj224 requested a review from ciarand October 10, 2019 20:23
@googlebot googlebot added the cla: yes Override cla label Oct 10, 2019
@@ -53,8 +55,6 @@
private static final String CONTENT_ENCODING_HEADER_KEY = "Content-Encoding";
private static final String GZIP_CONTENT_ENCODING = "gzip";

private static final String UNAUTHORIZED_ERROR_MESSAGE =
"The request did not have the required credentials.";
private static final String INTERNAL_SERVER_ERROR_MESSAGE = "There was an internal server error.";
private static final String NETWORK_ERROR_MESSAGE = "The server returned an unexpected error:";
Copy link
Contributor

Choose a reason for hiding this comment

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

missing a space between the colon and the error when you concat using +. It would be slightly less error prone to use either a format string here or have a dedicated method for generating these errors (or both)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. PTAL.

httpsURLConnection.addRequestProperty(CONTENT_TYPE_HEADER_KEY, JSON_CONTENT_TYPE);
httpsURLConnection.addRequestProperty(ACCEPT_HEADER_KEY, JSON_CONTENT_TYPE);
httpsURLConnection.addRequestProperty(CONTENT_ENCODING_HEADER_KEY, GZIP_CONTENT_ENCODING);
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a lot of overlap between this method and the other one that sets up a POST request. Can we maybe consolidate some of the shared logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* Simplifying FirebaseInstallations class by adding listeners.

* Addressing ciaran's comments to return same token if multiple getAuthToken()
calls are triggered simultaneously.

* Cleaning doRegistration method.

* Fixing FISClient to correctly parse expiration timestamp. (#848)

* Updating getAuthToken to return creation timestamp (#884)

* Propagating the exceptions to the clients. (#856)
@ankitaj224 ankitaj224 changed the base branch from listeners to fis_sdk October 10, 2019 22:32
@ankitaj224 ankitaj224 changed the base branch from fis_sdk to listeners October 10, 2019 22:33
@firebase firebase deleted a comment from google-oss-bot Oct 10, 2019
@ankitaj224 ankitaj224 requested a review from ciarand October 10, 2019 22:37
@ankitaj224
Copy link
Contributor Author

/retest

throw new FirebaseInstallationServiceException(
NETWORK_ERROR_MESSAGE + e.getMessage(),
FirebaseInstallationServiceException.Status.NETWORK_ERROR);
throw new FirebaseException(String.format(NETWORK_ERROR_MESSAGE, e.getMessage()));
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to embed the IOException as a cause?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IOException wraps many exceptions : MalformedException, ProtocolException, UnknownServiceException etc. My reasoning to add this as a cause for users to know what went wrong and handle accordingly.

@ankitaj224
Copy link
Contributor Author

/retest

@ankitaj224
Copy link
Contributor Author

/test new-smoke-tests

1 similar comment
@ankitaj224
Copy link
Contributor Author

/test new-smoke-tests

@ankitaj224
Copy link
Contributor Author

/retest

@ankitaj224
Copy link
Contributor Author

/test new-smoke-tests

@ankitaj224 ankitaj224 merged commit 5a181dc into listeners Oct 14, 2019
@ankitaj224 ankitaj224 deleted the retry branch October 14, 2019 20:31
ankitaj224 added a commit that referenced this pull request Oct 14, 2019
* Fixing FISClient to correctly parse expiration timestamp. (#848)

* Updating getAuthToken to return creation timestamp (#884)

* Propagating the exceptions to the clients. (#856)

* Extract FID from FIS createInstallation response (#888)

* Addressing Rayo's comment: Rename PersistedFidEntry to (#899)

* Implementing retry once for FIS Client. (#895)

* Simplifying FirebaseInstallations class by adding listeners. (#847)

* Fixing FISClient to correctly parse expiration timestamp. (#848)

* Updating getAuthToken to return creation timestamp (#884)

* Propagating the exceptions to the clients. (#856)
@firebase firebase locked and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants