Merge branch 'dev' into 'dev'

Added more timeout exception checking to http_client.py.

See merge request pleroma/relay!48
This commit is contained in:
Sylvain Jones 2022-12-21 22:32:34 +00:00
commit 009a7b594f
2 changed files with 10 additions and 3 deletions

View file

@ -9,7 +9,13 @@ a = Analysis(
pathex=[], pathex=[],
binaries=[], binaries=[],
datas=[], datas=[],
hiddenimports=[], hiddenimports=[
'aputils.enums',
'aputils.errors',
'aputils.misc',
'aputils.objects',
'aputils.signer'
],
hookspath=[], hookspath=[],
hooksconfig={}, hooksconfig={},
runtime_hooks=[], runtime_hooks=[],

View file

@ -2,7 +2,8 @@ import logging
import traceback import traceback
from aiohttp import ClientSession, ClientTimeout, TCPConnector from aiohttp import ClientSession, ClientTimeout, TCPConnector
from aiohttp.client_exceptions import ClientConnectorError, ServerTimeoutError from aiohttp.client_exceptions import ClientConnectorError, ServerTimeoutError, ServerDisconnectedError
from asyncio.exceptions import TimeoutError
from aputils import Nodeinfo, WellKnownNodeinfo from aputils import Nodeinfo, WellKnownNodeinfo
from datetime import datetime from datetime import datetime
from cachetools import LRUCache from cachetools import LRUCache
@ -158,7 +159,7 @@ class HttpClient:
logging.verbose(f'Received error when pushing to {url}: {resp.status}') logging.verbose(f'Received error when pushing to {url}: {resp.status}')
return logging.verbose(await resp.read()) # change this to debug return logging.verbose(await resp.read()) # change this to debug
except (ClientConnectorError, ServerTimeoutError): except (ClientConnectorError, ServerTimeoutError, TimeoutError, ServerDisconnectedError):
logging.verbose(f'Failed to connect to {url}') logging.verbose(f'Failed to connect to {url}')
## prevent workers from being brought down ## prevent workers from being brought down