-
Notifications
You must be signed in to change notification settings - Fork 322
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
Manage analytics client to avoid leaks #9611
Conversation
This change makes sure to close the Google Analytics client after usage. This will a) ensure that resources are released properly b) potentially fix the exception that is causing problems on some platforms
analytics_data = case credentials of | ||
Google_Credential.Default -> BetaAnalyticsDataClient.create | ||
managed_analytics_data = case credentials of | ||
Google_Credential.Default -> Managed_Resource (BetaAnalyticsDataClient.create) r-> r.close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this line uses Managed _Resource
and the line 24 is using...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoking a type
looks like a coding mistake.
Google_Credential.From_File _ -> | ||
betaAnalyticsDataSettings = BetaAnalyticsDataSettings.newBuilder | ||
. setCredentialsProvider credentials.as_java | ||
. build | ||
BetaAnalyticsDataClient.create betaAnalyticsDataSettings | ||
Managed_Resource.register (BetaAnalyticsDataClient.create betaAnalyticsDataSettings) r-> r.close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...this line is using Managed_Resource.register
while line 19 only Managed_Resource
.
Pull Request Description
This change makes sure to close the Google Analytics client after usage. This will a) ensure that resources are released properly b) potentially fix the exception that is causing problems on some platforms
Important Notes
After this change I no longer see in my logs:
It's important because apparently that's where it would get stuck when trying to log that message.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.