firebase / firebase/firebase-admin-python

[FR] Allow poolsize and maxpool size settings for http client

Đang mở
#648 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: core type: feature request
Ngôn ngữ chính
Python
Star
1.2k
Fork
359
Merge trung bình
5 ngày 6 phút
Pull request đã merge (30 ngày)
2

Mô tả

**Is your feature request related to a problem? Please describe.**
I am currently facing a performance issue in which the default max pool size of requests library has become a bottleneck.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
I was wondering if we could increase the pool size by taking them as parameters for message client constructor
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**

```

class HttpClient:
def __init__(
self, credential=None, session=None, base_url='', headers=None,
retries=DEFAULT_RETRY_CONFIG, timeout=DEFAULT_TIMEOUT_SECONDS,
pool_connections=DEFAULT_POOL_CONNECTIONS, pool_maxsize=DEFAULT_MAX_POOL_SIZE
):
if credential:
self._session = transport.requests.AuthorizedSession(credential)
elif session:
self._session = session
else:
self._session = requests.Session() # pylint: disable=redefined-variable-type

if headers:
self._session.headers.update(headers)
if retries:
self._session.mount('http://', requests.adapters.HTTPAdapter(max_retries=retries))
self._session.mount('https://', requests.adapters.HTTPAdapter(max_retries=retries))

self._session.mount('http://', requests.adapters.HTTPAdapter(pool_connections=pool_connections, pool_maxsize=pool_maxsize))
self._session.mount('https://', requests.adapters.HTTPAdapter(pool_connections=pool_connections, pool_maxsize=pool_maxsize))

self._base_url = base_url
self._timeout = timeout
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.