python-keycloak icon indicating copy to clipboard operation
python-keycloak copied to clipboard

feat: add pool_maxsize parameter to connection managers

Open andrewmooreio opened this issue 6 months ago • 1 comments

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_maxsize parameter to relevant test fixtures in tests/conftest.py with a non-default value (5).
  • Added assertions in tests/test_keycloak_openid.py (test_keycloak_openid_init and test_a_well_known) to verify pool_maxsize is correctly set on the ConnectionManager for KeycloakOpenID.
  • Added assertions in tests/test_keycloak_admin.py (test_keycloak_admin_init and test_a_realms) to verify pool_maxsize is correctly set on the ConnectionManager for KeycloakAdmin.

andrewmooreio avatar May 13 '25 14:05 andrewmooreio

Note, the failed tests seem to be unrelated to this change and have been failing in CI for a while.

andrewmooreio avatar May 13 '25 14:05 andrewmooreio