Fix default_role being ignored when query_parser_enabled was false (#847)

Fix default_role being ignored when query_parser_enabled was false
This commit is contained in:
Jose Fernández
2024-11-07 18:11:49 +01:00
committed by GitHub
parent cdcfa99fb9
commit c9544bdff2
3 changed files with 41 additions and 1 deletions

View File

@@ -881,6 +881,7 @@ where
};
query_router.update_pool_settings(&pool.settings);
query_router.set_default_role();
// Our custom protocol loop.
// We expect the client to either start a transaction with regular queries

View File

@@ -1061,6 +1061,11 @@ impl QueryRouter {
self.active_shard
}
/// Set active_role as the default_role specified in the pool.
pub fn set_default_role(&mut self) {
self.active_role = self.pool_settings.default_role;
}
/// Get the current desired server role we should be talking to.
pub fn role(&self) -> Option<Role> {
self.active_role