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

Http client in Firebase Segmentation SDK to call backend service. #573

Merged
merged 45 commits into from
Jul 22, 2019

Conversation

diwu-arete
Copy link
Contributor

cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)
@googlebot googlebot added the cla: yes Override cla label Jun 26, 2019
@diwu-arete diwu-arete self-assigned this Jun 26, 2019
Copy link
Member

@vkryachko vkryachko left a comment

Choose a reason for hiding this comment

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

Also, given your limited needs in terms of http, I'd strongly suggest you consider using HttpUrlConnection instead of okhttp

@diwu-arete
Copy link
Contributor Author

Changed okhttpclient to httpsUrlConnection

@@ -36,12 +39,14 @@
private final FirebaseInstanceId firebaseInstanceId;
private final CustomInstallationIdCache localCache;
private final SegmentationServiceClient backendServiceClient;
private final Executor executor;

FirebaseSegmentation(FirebaseApp firebaseApp) {
Copy link
Member

Choose a reason for hiding this comment

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

Could this constructor delegate to the one below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

}
TaskCompletionSource<Void> taskCompletionSource = new TaskCompletionSource<>();

executor.execute(
Copy link
Member

Choose a reason for hiding this comment

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

2 points:

  • There is a dedicated Tasks.call(executor, callable) to achieve this effect
  • Consider extracting the lambda below into its own (private) method that you can annotate with @WorkerThread

This applies to the here and throughout as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good learning!
Done

@diwu-arete diwu-arete merged commit d07ec25 into floc-master Jul 22, 2019
@firebase firebase locked and limited conversation to collaborators Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants