fix(mysql): prevent stale export pool cleanup

This commit is contained in:
Guoyu Su authored and GitHub committed 2026-08-25 22:50:40 +08:00
1 parent aa91a0aaa9
commit 0658d18922
8 files changed
+400 -66

No files matched your search

+8
View File
@@ -55,6 +55,14 @@ impl MySqlPool {
pub async fn disconnect(self) -> Result<(), mysql_async::Error> {
self.inner.disconnect().await
}
/// Returns whether both handles refer to the same underlying pool
/// generation. Pool options are not an identity: a reconnect creates a new
/// pool with identical options, and a late health probe for the old pool
/// must not be allowed to remove that replacement from routing.
pub(crate) fn is_same_pool(&self, other: &Self) -> bool {
std::sync::Arc::ptr_eq(&self.inner.metrics(), &other.inner.metrics())
}
}
impl Deref for MySqlPool {