Skip to content

Commit

Permalink
#209: Change 'max capacity' to 'max size'
Browse files Browse the repository at this point in the history
- This change should just help make things a bit clearer due to 'init size', make the terminology more similar
  • Loading branch information
MRichards99 committed Apr 6, 2021
1 parent e4abe88 commit 33bdcd1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"backend": "db",
"client_cache_size": 5,
"client_pool_init_size": 2,
"client_pool_max_capacity": 5,
"client_pool_max_size": 5,
"DB_URL": "mysql+pymysql://icatdbuser:icatdbuserpw@localhost:3306/icatdb",
"ICAT_URL": "https://localhost:8181",
"icat_check_cert": false,
Expand Down
6 changes: 3 additions & 3 deletions datagateway_api/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def get_client_pool_init_size(self):
except KeyError:
sys.exit("Missing config value, client_pool_init_size")

def get_client_pool_max_capacity(self):
def get_client_pool_max_size(self):
try:
return self.config["client_pool_max_capacity"]
return self.config["client_pool_max_size"]
except KeyError:
sys.exit("Missing config value, client_pool_max_capacity")
sys.exit("Missing config value, client_pool_max_size")

def get_db_url(self):
try:
Expand Down
2 changes: 1 addition & 1 deletion datagateway_api/common/icat/icat_client_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create_client_pool():
return ObjectPool(
ICATClient,
min_init=config.get_client_pool_init_size(),
max_capacity=config.get_client_pool_max_capacity(),
max_capacity=config.get_client_pool_max_size(),
max_reusable=0,
expires=0,
)
Expand Down
8 changes: 4 additions & 4 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def test_invalid_client_cache_size(self, invalid_config):
invalid_config.get_client_pool_init_size()


class TestGetClientPoolMaxCapacity:
class TestGetClientPoolMaxSize:
def test_valid_client_pool_init_size(self, valid_config):
pool_max_capacity = valid_config.get_client_pool_max_capacity()
assert pool_max_capacity == 5
pool_max_size = valid_config.get_client_pool_max_size()
assert pool_max_size == 5

def test_invalid_client_cache_size(self, invalid_config):
with pytest.raises(SystemExit):
invalid_config.get_client_pool_max_capacity()
invalid_config.get_client_pool_max_size()


class TestGetDBURL:
Expand Down

0 comments on commit 33bdcd1

Please sign in to comment.