fix(relay): auto-reconnect on Telegram AUTH_KEY_DUPLICATED and fix IranIntl handle (#539)

- On AUTH_KEY_DUPLICATED (406), disconnect client and set to null so
  next poll cycle reconnects fresh — self-heals after competing client dies
- Fix IranIntl → iranintltv (correct Telegram channel handle)
This commit is contained in:
Elie Habib
2026-02-28 16:54:51 +04:00
committed by GitHub
parent 1f07a258aa
commit 43f45430e4
2 changed files with 7 additions and 1 deletions

View File

@@ -86,7 +86,7 @@
"maxMessages": 25
},
{
"handle": "IranIntl",
"handle": "iranintltv",
"label": "Iran International",
"topic": "politics",
"tier": 2,

View File

@@ -290,6 +290,12 @@ async function pollTelegramOnce() {
const em = e?.message || String(e);
telegramState.lastError = `poll ${handle} failed: ${em}`;
console.warn('[Relay] Telegram poll error:', telegramState.lastError);
if (/AUTH_KEY_DUPLICATED/.test(em)) {
console.warn('[Relay] Telegram session conflict — destroying client, will reconnect next cycle');
try { telegramState.client?.disconnect(); } catch {}
telegramState.client = null;
break;
}
}
}