-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: silent refresh errors on active connection #219
fix: silent refresh errors on active connection #219
Conversation
When an instance already have active connections, it should not throw errors when trying to refresh cloud instance certificates in the background. Otherwise these errors will bubble up and stop the end user application. This changeset fixes it by adding a more resilient system to the CloudSQLInstance refresh logic that silents errors occured during refresh and keeps valid certificate data that can be used if a refresh is still ongoing or if any error happens when during a refresh. Fixes: #201
90fadef
to
c9ec581
Compare
@ruyadorno Let's try and keep naming consistent across languages where we can. This will help the long-term maintenance burden and allow future maintainers to ramp up on the code base a lot quicker. |
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.
src/cloud-sql-instance.ts
Outdated
// refresh errors to the final user, scheduling a new refresh instead. | ||
if (this.stablishedConnection) { | ||
if (currentRefreshId === this.scheduledRefreshID) { | ||
this.scheduleRefresh(); |
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.
What happens to caller here? Do we block them until a new refresh is done? What happens if the refresh continues to fail? Do we block the event loop?
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.
No, we never block the event loop. What happens is that the current metadata value is still used for connections in that case.
095ecc4
to
0447d6e
Compare
Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
When an instance already have active connections, it should not throw errors when trying to refresh cloud instance certificates in the background. Otherwise these errors will bubble up and stop the end user application.
This PR fixes it by adding a more resilient system to the CloudSQLInstance refresh logic that silents errors occured during refresh and keeps valid certificate data that can be used if a refresh is still ongoing or if any error happens when during a refresh.
Fixes: #201