-
Notifications
You must be signed in to change notification settings - Fork 286
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
Core pooling logic #2686
Core pooling logic #2686
Conversation
…se and release internal connection to pool.
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.
I think this matches our discussion about pooling (pending the missing parts you've already noted.) There are a few points of code formatting/indentation/resource strings, but nothing worth a specific comment until the PR's out of draft. I'm happy with the base methodology (besides one or two nits in review comments.)
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClientX/PoolingDataSource.cs
Outdated
Show resolved
Hide resolved
|
||
|
||
[Fact] | ||
public async Task MinPoolSize_equals_MaxPoolSize() |
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.
Just going to suggest my philosophy of unit test organization - organizing them into Arrange, Act, Assert is a fairly standard practice that helps make it clear what's being tested.
} | ||
|
||
[Fact] | ||
public void MinPoolSize_bigger_than_MaxPoolSize_throws() |
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.
Also usually naming the tests like MethodName_OptionalCondition_Outcome
is a bit more readable
Eg, for this one I'd rename it MinPoolSize_BiggerThanMaxPoolSize_Throws
}; | ||
|
||
// Start an async open which will not complete as the pool is exhausted. | ||
var asyncOpenerTask = asyncOpener(); |
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.
I'm a bit confused on this one... Would this be more simply expressed using Task.Run
?
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.
A few low-tier commends, but nothing that I'd hold up checkin in on. I think.
This PR covers core pooling logic including SqlConnector creation, retrieval, return, and statistics. Integrates with rate limiter scaffolding added in #2667. Also covers small fixes for create, close, and dispose flows exposed by unit tests.
Not included in this PR are: