Skip to content

Commit

Permalink
Switch request properties to be loaded via env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemanja Martinovic committed Sep 2, 2022
1 parent e698f24 commit 5f321f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade setuptools pip
git config --global url."https://".insteadOf git://
pip install -U -r requirements.txt
pip install -U -r dev-requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion adsws/api/discoverer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, endpoint, service_uri, deploy_path, route):
# requests sessions)
# http://docs.python-requests.org/en/latest/api/?highlight=max_retries#requests.adapters.HTTPAdapter
#
http_adapter = requests.adapters.HTTPAdapter(pool_connections=20, pool_maxsize=1000, max_retries=1, pool_block=False)
http_adapter = requests.adapters.HTTPAdapter(pool_connections=current_app.config.get("REQUESTS_POOL_CONNECTIONS", 20), pool_maxsize=current_app.config.get("REQUESTS_POOL_MAXSIZE", 1000), max_retries=current_app.config.get("REQUESTS_POOL_RETRIES", 1), pool_block=False)
self.session.mount('http://', http_adapter)

@staticmethod
Expand Down
4 changes: 4 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
# Flask session config (http://flask.pocoo.org/docs/0.12/config/)
PERMANENT_SESSION_LIFETIME = 3600*24*365.25 # 1 year in seconds
SESSION_REFRESH_EACH_REQUEST = True

REQUESTS_POOL_CONNECTIONS=20
REQUESTS_POOL_MAXSIZE=1000
REQUESTS_POOL_RETRIES=1

0 comments on commit 5f321f2

Please sign in to comment.