search: do not log as errors HTTP failures in search engines (#34314)
This commit is contained in:
parent
f4616afea8
commit
41d884e88f
|
@ -155,6 +155,8 @@ class SearchCell(CellBase):
|
||||||
# be set explicitely in the URL template in the engine definition (via
|
# be set explicitely in the URL template in the engine definition (via
|
||||||
# {{user_nameid}} or {{user_email}}).
|
# {{user_nameid}} or {{user_email}}).
|
||||||
kwargs['without_user'] = True
|
kwargs['without_user'] = True
|
||||||
|
# don't send error traces on HTTP errors
|
||||||
|
kwargs['log_errors'] = 'warn'
|
||||||
results = requests.get(url, **kwargs).json()
|
results = requests.get(url, **kwargs).json()
|
||||||
if service.get('data_key'):
|
if service.get('data_key'):
|
||||||
results['data'] = results.get(service['data_key']) or []
|
results['data'] = results.get(service['data_key']) or []
|
||||||
|
|
|
@ -127,7 +127,10 @@ class Requests(RequestsSession):
|
||||||
extra = {}
|
extra = {}
|
||||||
if django_request:
|
if django_request:
|
||||||
extra['request'] = django_request
|
extra['request'] = django_request
|
||||||
logging.error('failed to %s %s (%s)', method, url, response.status_code, extra=extra)
|
if log_errors == 'warn':
|
||||||
|
logging.warning('failed to %s %s (%s)', method, url, response.status_code, extra=extra)
|
||||||
|
else:
|
||||||
|
logging.error('failed to %s %s (%s)', method, url, response.status_code, extra=extra)
|
||||||
if method == 'GET' and cache_duration and (response.status_code // 100 == 2):
|
if method == 'GET' and cache_duration and (response.status_code // 100 == 2):
|
||||||
cache.set(cache_key, response.content, cache_duration)
|
cache.set(cache_key, response.content, cache_duration)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue