mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
aggregator timeout fixes (#310):
- fix memento aggregation if timeout is 0.0 - use default timeout (5.0), instead of default to 0.0 and failing - add 'timeout' property to warcserver aggregation tests - docs: mention property in warcserver docs also
This commit is contained in:
parent
8f981743ae
commit
d732cdd01f
@ -216,8 +216,13 @@ lookup three remote archives, two using memento, and one using CDX Server API::
|
|||||||
ia: cdx+http://web.archive.org/cdx;/web
|
ia: cdx+http://web.archive.org/cdx;/web
|
||||||
apt: memento+http://arquivo.pt/wayback/
|
apt: memento+http://arquivo.pt/wayback/
|
||||||
|
|
||||||
|
timeout: 10
|
||||||
|
|
||||||
This allows Warcserver to serve as a "Memento Aggregator", aggregating results from
|
This allows Warcserver to serve as a "Memento Aggregator", aggregating results from
|
||||||
multiple existing archives (using the Memento API and other APIs)
|
multiple existing archives (using the Memento API and other APIs).
|
||||||
|
|
||||||
|
An optional ``timeout`` property configures how many seconds to wait for each source before
|
||||||
|
it is considered to have 'timed out'. (If unspecified, the default value is 5 seconds).
|
||||||
|
|
||||||
Sequential Fallback Collections
|
Sequential Fallback Collections
|
||||||
"""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""
|
||||||
|
@ -220,10 +220,12 @@ class TimeoutMixin(object):
|
|||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
class GeventMixin(object):
|
class GeventMixin(object):
|
||||||
|
DEFAULT_TIMEOUT = 5.0
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(GeventMixin, self).__init__(*args, **kwargs)
|
super(GeventMixin, self).__init__(*args, **kwargs)
|
||||||
self.pool = Pool(size=kwargs.get('size'))
|
self.pool = Pool(size=kwargs.get('size'))
|
||||||
self.timeout = kwargs.get('timeout', 5.0)
|
self.timeout = kwargs.get('timeout') or self.DEFAULT_TIMEOUT
|
||||||
|
|
||||||
def _load_all(self, params):
|
def _load_all(self, params):
|
||||||
params['_timeout'] = self.timeout
|
params['_timeout'] = self.timeout
|
||||||
|
@ -34,7 +34,7 @@ aggs_inv = {'simple': SimpleAggregator(sources, invert_sources=True),
|
|||||||
'gevent': GeventTimeoutAggregator(sources, invert_sources=True, timeout=5.0),
|
'gevent': GeventTimeoutAggregator(sources, invert_sources=True, timeout=5.0),
|
||||||
}
|
}
|
||||||
|
|
||||||
agg_tm = {'gevent': GeventTimeoutAggregator(sources, timeout=0.0)}
|
agg_tm = {'gevent': GeventTimeoutAggregator(sources, timeout=0.05)}
|
||||||
|
|
||||||
nf = {'notfound': FileIndexSource('testdata/not-found-x')}
|
nf = {'notfound': FileIndexSource('testdata/not-found-x')}
|
||||||
agg_nf = {'simple': SimpleAggregator(nf),
|
agg_nf = {'simple': SimpleAggregator(nf),
|
||||||
|
@ -43,6 +43,8 @@ collections:
|
|||||||
apt: memento+http://arquivo.pt/wayback/
|
apt: memento+http://arquivo.pt/wayback/
|
||||||
liveweb: live
|
liveweb: live
|
||||||
|
|
||||||
|
timeout: 10
|
||||||
|
|
||||||
# Local Dir CDX
|
# Local Dir CDX
|
||||||
local:
|
local:
|
||||||
index: ./local/indexes
|
index: ./local/indexes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user