Skip to content

Enabling FIS network call timeout. #827

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 2 commits into from
Sep 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public class FirebaseInstallationServiceClient {
private static final String X_ANDROID_PACKAGE_HEADER_KEY = "X-Android-Package";
private static final String X_ANDROID_CERT_HEADER_KEY = "X-Android-Cert";

private static final int NETWORK_TIMEOUT_MILLIS = 10000;

private final Context context;

public FirebaseInstallationServiceClient(@NonNull Context context) {
Expand Down Expand Up @@ -90,6 +92,8 @@ public InstallationResponse createFirebaseInstallation(
apiKey));

HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setConnectTimeout(NETWORK_TIMEOUT_MILLIS);
httpsURLConnection.setReadTimeout(NETWORK_TIMEOUT_MILLIS);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.addRequestProperty(CONTENT_TYPE_HEADER_KEY, JSON_CONTENT_TYPE);
Expand Down Expand Up @@ -165,6 +169,8 @@ public void deleteFirebaseInstallation(
apiKey));

HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setConnectTimeout(NETWORK_TIMEOUT_MILLIS);
httpsURLConnection.setReadTimeout(NETWORK_TIMEOUT_MILLIS);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setRequestMethod("DELETE");
httpsURLConnection.addRequestProperty("Authorization", "FIS_v2 " + refreshToken);
Expand Down Expand Up @@ -219,6 +225,8 @@ public InstallationTokenResult generateAuthToken(
apiKey));

HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setConnectTimeout(NETWORK_TIMEOUT_MILLIS);
httpsURLConnection.setReadTimeout(NETWORK_TIMEOUT_MILLIS);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.addRequestProperty("Authorization", "FIS_v2 " + refreshToken);
Expand Down