Skip to content

Commit

Permalink
Increase the default cache size to 100
Browse files Browse the repository at this point in the history
- Many users are multithreading and using unique URLs across multiple chains. This cache shoudn't be too memory intensive and ``100`` seems like a decent limit to allow plenty of room for these use cases.
  • Loading branch information
fselmo committed Oct 24, 2022
1 parent a766b7e commit 2f7b627
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/2690.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Increase request session cache size from ``20`` to ``100``.
4 changes: 2 additions & 2 deletions web3/_utils/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_default_http_endpoint() -> URI:
return URI(os.environ.get("WEB3_HTTP_PROVIDER_URI", "http://localhost:8545"))


_session_cache = SessionCache(size=20)
_session_cache = SessionCache(size=100)
_session_cache_lock = threading.Lock()


Expand Down Expand Up @@ -145,7 +145,7 @@ def _close_evicted_sessions(evicted_sessions: List[requests.Session]) -> None:
# --- async --- #


_async_session_cache = SessionCache(size=20)
_async_session_cache = SessionCache(size=100)
_async_session_cache_lock = threading.Lock()
_pool = ThreadPoolExecutor(max_workers=1)

Expand Down

0 comments on commit 2f7b627

Please sign in to comment.