mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
wrapper cache_true
This commit is contained in:
parent
15271835f6
commit
976ff1b20d
@ -34,7 +34,7 @@ import urllib3
|
||||
from urllib3.exceptions import HTTPError
|
||||
import collections
|
||||
from concurrent import futures
|
||||
from functools import lru_cache
|
||||
from functools import lru_cache, wraps
|
||||
|
||||
urllib3.disable_warnings()
|
||||
|
||||
@ -62,6 +62,17 @@ class DedupableMixin(object):
|
||||
else:
|
||||
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)
|
||||
def skip_revisit(hash_plus_url, revisit_key, conn):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user