Open lynxis opened 2 years ago
in theory pydle should do this, but it doesn't. maybe override on_disconnect() of myownbot class to allow this.
Needs further investigation. It might be fixed by now.
git rev: fc1ae2d5d1251da23340bed3d6f6f0a1ab183891
Oct 20 02:29:29 afra pipenv[2248894]: ERROR:asyncio:Task exception was never retrieved
Oct 20 02:29:29 afra pipenv[2248894]: future: <Task finished name='Task-15' coro=<BasicClient.handle_forever() done, defined at /home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/client.py:363> exception=TimeoutError(110, "Connect call failed ('176.56.239.136', 6697)")>
Oct 20 02:29:29 afra pipenv[2248894]: Traceback (most recent call last):
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/client.py", line 380, in handle_forever
Oct 20 02:29:29 afra pipenv[2248894]: await self.disconnect(expected=False)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/client.py", line 136, in disconnect
Oct 20 02:29:29 afra pipenv[2248894]: await self._disconnect(expected)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/client.py", line 146, in _disconnect
Oct 20 02:29:29 afra pipenv[2248894]: await self.on_disconnect(expected)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/client.py", line 338, in on_disconnect
Oct 20 02:29:29 afra pipenv[2248894]: await self.connect(reconnect=True)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/features/tls.py", line 35, in connect
Oct 20 02:29:29 afra pipenv[2248894]: return await super().connect(hostname, port, tls=tls, **kwargs)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/features/rfc1459/client.py", line 190, in connect
Oct 20 02:29:29 afra pipenv[2248894]: await super().connect(hostname, port, **kwargs)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/client.py", line 124, in connect
Oct 20 02:29:29 afra pipenv[2248894]: await self._connect(hostname=hostname, port=port, reconnect=reconnect, **kwargs)
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/features/tls.py", line 54, in _connect
Oct 20 02:29:29 afra pipenv[2248894]: await self.connection.connect()
Oct 20 02:29:29 afra pipenv[2248894]: File "/home/afra/.local/share/virtualenvs/v4runa-mmIZGijq/lib/python3.9/site-packages/pydle/connection.py", line 48, in connect
Oct 20 02:29:29 afra pipenv[2248894]: (self.reader, self.writer) = await asyncio.open_connection(
Oct 20 02:29:29 afra pipenv[2248894]: File "/usr/lib/python3.9/asyncio/streams.py", line 52, in open_connection
Oct 20 02:29:29 afra pipenv[2248894]: transport, _ = await loop.create_connection(
Oct 20 02:29:29 afra pipenv[2248894]: File "/usr/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
Oct 20 02:29:29 afra pipenv[2248894]: raise exceptions[0]
Oct 20 02:29:29 afra pipenv[2248894]: File "/usr/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
Oct 20 02:29:29 afra pipenv[2248894]: sock = await self._connect_sock(
Oct 20 02:29:29 afra pipenv[2248894]: File "/usr/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
Oct 20 02:29:29 afra pipenv[2248894]: await self.sock_connect(sock, address)
Oct 20 02:29:29 afra pipenv[2248894]: File "/usr/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
Oct 20 02:29:29 afra pipenv[2248894]: return await fut
Oct 20 02:29:29 afra pipenv[2248894]: File "/usr/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
Oct 20 02:29:29 afra pipenv[2248894]: raise OSError(err, f'Connect call failed {address}')
Oct 20 02:29:29 afra pipenv[2248894]: TimeoutError: [Errno 110] Connect call failed ('176.56.239.136', 6697)
Oct 20 02:30:01 afra pipenv[2248894]: INFO:v4runa:mqtt: delivered a message
Oct 20 02:31:01 afra pipenv[2248894]: INFO:v4runa:mqtt: delivered a message
It looks the exception comes from pydle. I've setup an exception handler and hope this will catch at least those exception. We could ignore the auto-reconnect of pydle and implement it in our code. The exception handler will just exit v4runa and systemd should restart v4runa afterwards.
v4runa doesn't reconnect to IRC.