Skip to content

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

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 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 requested a review from shrutip90 June 26, 2019 20:24
@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 diwu-arete requested a review from vkryachko July 9, 2019 17:58
@diwu-arete
Copy link
Contributor Author

Changed okhttpclient to httpsUrlConnection

@diwu-arete diwu-arete requested a review from vkryachko July 18, 2019 19:05
@@ -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 requested a review from vkryachko July 22, 2019 18:44
@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