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

Driver context #300

Merged
merged 1 commit into from
Jun 23, 2021
Merged

Driver context #300

merged 1 commit into from
Jun 23, 2021

Conversation

lippserd
Copy link
Member

No description provided.

@lippserd lippserd added this to the v1.0.0-rc2 milestone Jun 18, 2021
@lippserd lippserd added this to In progress in v1.0.0-rc2 via automation Jun 18, 2021
@lippserd lippserd marked this pull request as ready for review June 21, 2021 16:03
pkg/driver/driver.go Outdated Show resolved Hide resolved
Our driver now supports DriverContext and uses contexts.
This basically supports that the connect function returns
immediately when a context is cancelled.
Copy link
Contributor

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

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

Does the Go sql package guarantee to always use DriverContext if available? Or would it make sense to also explicitly implement the Open() function from the Driver interface (simply calling Connect(context.Background())) to ensure that Open() also retries?

@lippserd
Copy link
Member Author

Does the Go sql package guarantee to always use DriverContext if available? Or would it make sense to also explicitly implement the Open() function from the Driver interface (simply calling Connect(context.Background())) to ensure that Open() also retries?

Yep, DriverContext will always be used if available:

https://github.com/golang/go/blob/2ebe77a2fda1ee9ff6fd9a3e08933ad1ebaea039/src/database/sql/driver/driver.go#L10
https://github.com/golang/go/blob/2ebe77a2fda1ee9ff6fd9a3e08933ad1ebaea039/src/database/sql/driver/driver.go#L97
https://github.com/golang/go/blob/10d625d5b41f17c118da18a592c683e60fcdcb3b/src/database/sql/sql.go#L824

v1.0.0-rc2 automation moved this from In progress to Reviewer approved Jun 23, 2021
@lippserd lippserd merged commit f8315de into master Jun 23, 2021
@lippserd lippserd deleted the driver-context branch June 23, 2021 07:03
v1.0.0-rc2 automation moved this from Reviewer approved to Done Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants