python-keycloak
python-keycloak copied to clipboard
feat: add pool_maxsize parameter to connection managers
Description
This PR adds a pool_maxsize parameter to the KeycloakOpenID and KeycloakAdmin classes. This parameter is passed to the internal ConnectionManager, allowing users to configure the maximum number of connections to keep in the connection pool.
Motivation/Context
Controlling the connection pool size is important for managing resource usage and improving performance in applications that make frequent calls to Keycloak. By exposing this parameter, users of the library can fine-tune the connection behaviour to better suit their environment and workload, potentially reducing overhead from establishing new connections.
Should resolve: https://github.com/marcospereirampj/python-keycloak/issues/630
Testing Evidence
- Added
pool_maxsizeparameter to relevant test fixtures intests/conftest.pywith a non-default value (5). - Added assertions in
tests/test_keycloak_openid.py(test_keycloak_openid_initandtest_a_well_known) to verifypool_maxsizeis correctly set on theConnectionManagerforKeycloakOpenID. - Added assertions in
tests/test_keycloak_admin.py(test_keycloak_admin_initandtest_a_realms) to verifypool_maxsizeis correctly set on theConnectionManagerforKeycloakAdmin.
Note, the failed tests seem to be unrelated to this change and have been failing in CI for a while.