fix irc connect

This commit is contained in:
Yuriy Yuriev
2026-05-20 15:00:21 +07:00
parent 429e605b47
commit ae936ffddb
+15 -2
View File
@@ -178,14 +178,27 @@ class TwitchIRCClient:
last_message_time = datetime.now()
drain_errors = 0
# Если задача стартует на паузе — ждём resume до подключения к IRC
if is_active and not is_active():
logger.info(f"⏸️ #{self.channel} waiting for resume before connecting...")
while is_active and not is_active():
await asyncio.sleep(2)
logger.info(f"▶️ #{self.channel} resumed, connecting to IRC")
if not await self.connect():
raise ConnectionError(f"IRC connect failed for #{self.channel}")
while duration == 0 or (datetime.now() - start_time).seconds < duration:
# === ПРОВЕРКА АКТИВНОСТИ ===
if is_active and not is_active():
logger.info("⏸️ Task paused/stopped, disconnecting...")
break
logger.info(f"⏸️ #{self.channel} paused, waiting for resume...")
await self.disconnect()
while is_active and not is_active():
await asyncio.sleep(2)
logger.info(f"▶️ #{self.channel} resumed, reconnecting")
await self.connect()
last_message_time = datetime.now()
continue
# Нет соединения — ждём перед повтором
if not self._connected: