diff --git a/proxy/endpoints.py b/proxy/endpoints.py index 58efff1..3ed4c06 100644 --- a/proxy/endpoints.py +++ b/proxy/endpoints.py @@ -176,6 +176,7 @@ def generate_endpoints(endpoint: str, abi_filepath: str) -> list: schains_internal_contract, schains_contract, nodes_contract, schain_hash) for schain_hash in schain_hashes ] + endpoints = list(filter(lambda item: item is not None, endpoints)) # TODO: hotfix! return endpoints diff --git a/proxy/nginx.py b/proxy/nginx.py index 0b1746a..5c7332d 100644 --- a/proxy/nginx.py +++ b/proxy/nginx.py @@ -81,6 +81,8 @@ def is_container_running(container) -> bool: def generate_nginx_configs(schains_endpoints: list) -> None: logger.info('Generating nginx configs...') for schain_endpoints in schains_endpoints: + if not schain_endpoints: + continue logger.info(f'Processing template for {schain_endpoints["chain_info"]["schain_name"]}...') process_nginx_config_template(schain_endpoints['chain_info'], SERVER_NAME) diff --git a/templates/upstream.conf.j2 b/templates/upstream.conf.j2 index 031347e..5dcf1ed 100644 --- a/templates/upstream.conf.j2 +++ b/templates/upstream.conf.j2 @@ -1,18 +1,18 @@ upstream {{ schain_name }} { ip_hash; {% for endpoint in http_endpoints %} - server {{ endpoint }} max_fails=1 fail_timeout=10s; + server {{ endpoint }} max_fails=1 max_conns=500 fail_timeout=10s; {% endfor %} } upstream ws-{{ schain_name }} { ip_hash; {% for endpoint in ws_endpoints %} - server {{ endpoint }} max_fails=1 fail_timeout=10s; + server {{ endpoint }} max_fails=1 max_conns=500 fail_timeout=10s; {% endfor %} } upstream storage-{{ schain_name }} { ip_hash; {% for endpoint in fs_endpoints %} - server {{ endpoint }} max_fails=1 fail_timeout=10s; + server {{ endpoint }} max_fails=1 max_conns=500 fail_timeout=10s; {% endfor %} }