fix irc connect
This commit is contained in:
+15
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user