mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
Increase urllib parse cache size
In python2/3, urllib parse caches in memory URL parsing results to avoid repeating the process for the same URL. The problem is that the default in memory cache size is just 20. https://github.com/python/cpython/blob/3.7/Lib/urllib/parse.py#L80 Since we do a lot of URL parsing, it makes sense to increase cache size.
This commit is contained in:
parent
38d6e4337d
commit
ddcde36982
@ -35,6 +35,13 @@ try:
|
||||
import urllib.parse as urllib_parse
|
||||
except ImportError:
|
||||
import urlparse as urllib_parse
|
||||
# In python2/3, urllib parse caches in memory URL parsing results to avoid
|
||||
# repeating the process for the same URL. The problem is that the default
|
||||
# in memory cache size is just 20.
|
||||
# https://github.com/python/cpython/blob/3.7/Lib/urllib/parse.py#L80
|
||||
# since we do a lot of URL parsing, it makes sense to increase cache size.
|
||||
urllib_parse.MAX_CACHE_SIZE = 2000
|
||||
|
||||
try:
|
||||
import http.client as http_client
|
||||
# In python3 http.client.parse_headers() enforces http_client._MAXLINE
|
||||
|
Loading…
x
Reference in New Issue
Block a user