mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
Merge branch 'limit_revisits' into qa
This commit is contained in:
commit
93667c7f7b
@ -34,7 +34,7 @@ import urllib3
|
|||||||
from urllib3.exceptions import HTTPError
|
from urllib3.exceptions import HTTPError
|
||||||
import collections
|
import collections
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
from functools import lru_cache
|
from functools import lru_cache, wraps
|
||||||
|
|
||||||
urllib3.disable_warnings()
|
urllib3.disable_warnings()
|
||||||
|
|
||||||
@ -62,6 +62,17 @@ class DedupableMixin(object):
|
|||||||
else:
|
else:
|
||||||
return recorded_url.response_recorder.payload_size() > self.min_binary_size
|
return recorded_url.response_recorder.payload_size() > self.min_binary_size
|
||||||
|
|
||||||
|
def cache_true(func):
|
||||||
|
@functools.wraps(func)
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
result = func(*args, **kwargs)
|
||||||
|
if result:
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
@cache_true
|
||||||
@lru_cache(maxsize=256)
|
@lru_cache(maxsize=256)
|
||||||
def skip_revisit(hash_plus_url, revisit_key, conn):
|
def skip_revisit(hash_plus_url, revisit_key, conn):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user