fix irc
This commit is contained in:
@@ -183,6 +183,8 @@ class TwitchIRCClient:
|
|||||||
logger.info(f"⏸️ #{self.channel} waiting for resume before connecting...")
|
logger.info(f"⏸️ #{self.channel} waiting for resume before connecting...")
|
||||||
while is_active and not is_active():
|
while is_active and not is_active():
|
||||||
await asyncio.sleep(2)
|
await asyncio.sleep(2)
|
||||||
|
if not is_active and not is_active():
|
||||||
|
return stats
|
||||||
logger.info(f"▶️ #{self.channel} resumed, connecting to IRC")
|
logger.info(f"▶️ #{self.channel} resumed, connecting to IRC")
|
||||||
|
|
||||||
if not await self.connect():
|
if not await self.connect():
|
||||||
@@ -265,7 +267,9 @@ class TwitchIRCClient:
|
|||||||
# Читаем строку
|
# Читаем строку
|
||||||
try:
|
try:
|
||||||
line = await asyncio.wait_for(self._read_line(), timeout=5.0)
|
line = await asyncio.wait_for(self._read_line(), timeout=5.0)
|
||||||
except (asyncio.TimeoutError, asyncio.CancelledError):
|
except asyncio.CancelledError:
|
||||||
|
raise
|
||||||
|
except asyncio.TimeoutError:
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"IRC read error: {e}")
|
logger.warning(f"IRC read error: {e}")
|
||||||
@@ -291,7 +295,9 @@ class TwitchIRCClient:
|
|||||||
stats["links_found"] += 1
|
stats["links_found"] += 1
|
||||||
try:
|
try:
|
||||||
await on_url_found(url, msg['display_name'])
|
await on_url_found(url, msg['display_name'])
|
||||||
except:
|
except asyncio.CancelledError:
|
||||||
|
raise
|
||||||
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|||||||
Reference in New Issue
Block a user