feat(core): expose acquired pool connections#4279
Open
angelnereira wants to merge 2 commits into
Open
Conversation
6d7ab7e to
4563689
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pool::num_acquired()to report checked-out pool connectionsnum_acquiredinPooldebug outputAnypool testsThis helps applications distinguish a full-but-idle pool from one where all connections are checked out, which is useful when diagnosing pool contention and
PoolTimedOuterrors.The SQLCipher change is test-only. The SQLite matrix was reporting all
sqlite-sqlciphertests as passed and then segfaulting at process exit; closing the test connections explicitly makes the teardown deterministic.Checks
cargo fmtcargo check -p sqlx-core --no-default-features --features any,_rt-tokiocargo clippy -p sqlx-core --no-default-features --features any,_rt-tokio -- -D warningscargo test --no-run --test any-pool --no-default-features --features any,sqlite,macros,runtime-tokioDATABASE_URL=sqlite::memory: cargo test --test any-pool pool_should_report_acquired_connections --no-default-features --features any,sqlite,macros,runtime-tokioRUSTFLAGS='--cfg sqlite_test_sqlcipher' DATABASE_URL=sqlite:tests/sqlite/sqlite.db cargo test --test sqlite-sqlcipher --no-default-features --features any,macros,migrate,sqlite,_unstable-all-types,runtime-tokio -- --test-threads=1RUSTFLAGS='--cfg sqlite_test_sqlcipher' DATABASE_URL=sqlite:tests/sqlite/sqlite.db cargo test --test sqlite-sqlcipher --no-default-features --features any,macros,migrate,sqlite,_unstable-all-types,runtime-smol -- --test-threads=1RUSTFLAGS='--cfg sqlite_test_sqlcipher' DATABASE_URL=sqlite:tests/sqlite/sqlite.db cargo test --no-default-features --features any,macros,migrate,sqlite,_unstable-all-types,runtime-tokio,sqlite-preupdate-hook -- --skip rustsec_2024_0363 --test-threads=1cargo test -p sqlx --doc --no-default-features --features any,postgres,macros,runtime-tokiogit diff --checkNote:
cargo clippy --test any-pool --no-default-features --features any,sqlite,macros,runtime-tokio -- -D warningscurrently reports an existingclippy::needless_question_markwarning insqlx-test/src/lib.rs, outside this change.