set requests-get timeout to fail quickly when a server is unresponsive
This commit is contained in:
parent
71be267613
commit
86e72edfc1
5 changed files with 7 additions and 3 deletions
|
@ -27,7 +27,7 @@ pyquerystring==1.0.2
|
||||||
pytz==2016.4
|
pytz==2016.4
|
||||||
redis==2.10.5
|
redis==2.10.5
|
||||||
requests==2.10.0
|
requests==2.10.0
|
||||||
rq==0.6.0
|
rq==0.5.6
|
||||||
sgmllib3k==1.0.0
|
sgmllib3k==1.0.0
|
||||||
six==1.10.0
|
six==1.10.0
|
||||||
SQLAlchemy==1.0.13
|
SQLAlchemy==1.0.13
|
||||||
|
|
|
@ -13,5 +13,5 @@ module=woodwind.wsgi
|
||||||
import=timers
|
import=timers
|
||||||
|
|
||||||
#attach-daemon=venv/bin/rqworker high
|
#attach-daemon=venv/bin/rqworker high
|
||||||
attach-daemon=venv/bin/rqworker high low
|
|
||||||
attach-daemon=venv/bin/python -m woodwind.websocket_server
|
attach-daemon=venv/bin/python -m woodwind.websocket_server
|
||||||
|
attach-daemon=venv/bin/rqworker high low
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
{{ entry.published | relative_time }}
|
{{ entry.published | relative_time }}
|
||||||
</time>
|
</time>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{ url_for('.index', entry=entry.permalink) }}" target="_blank">
|
<a href="{{ url_for('.index', entry=entry.permalink) }}" target="_blank">
|
||||||
<i class="fa fa-external-link"></i>
|
<i class="fa fa-external-link"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -40,6 +40,9 @@ def requests_get(url, **kwargs):
|
||||||
if 'Last-Modified' in lastresp.headers:
|
if 'Last-Modified' in lastresp.headers:
|
||||||
headers['If-Modified-Since'] = lastresp.headers['Last-Modified']
|
headers['If-Modified-Since'] = lastresp.headers['Last-Modified']
|
||||||
|
|
||||||
|
if 'timeout' not in kwargs:
|
||||||
|
kwargs['timeout'] = (9.1, 30)
|
||||||
|
|
||||||
current_app.logger.debug('fetching %s with args %s', url, kwargs)
|
current_app.logger.debug('fetching %s with args %s', url, kwargs)
|
||||||
resp = requests.get(url, **kwargs)
|
resp = requests.get(url, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ def update_micropub_syndicate_to():
|
||||||
resp, resp.text)
|
resp, resp.text)
|
||||||
return
|
return
|
||||||
|
|
||||||
flask.current_app.logger.debug('syndicate-to response: {}, {}',
|
flask.current_app.logger.debug('syndicate-to response: %s %s',
|
||||||
resp, resp.text)
|
resp, resp.text)
|
||||||
|
|
||||||
content_type = resp.headers['content-type']
|
content_type = resp.headers['content-type']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue