feat: harden intelligence runtime and llm providers
This commit is contained in:
@@ -41,6 +41,8 @@ export class TelegramAlerter {
|
||||
this._commandHandlers = {}; // Registered command callbacks
|
||||
this._pollingInterval = null;
|
||||
this._botUsername = null;
|
||||
this._pollFailureCount = 0;
|
||||
this._lastPollErrorLogAt = 0;
|
||||
}
|
||||
|
||||
get isConfigured() {
|
||||
@@ -353,6 +355,7 @@ export class TelegramAlerter {
|
||||
|
||||
const data = await res.json();
|
||||
if (!data.ok || !Array.isArray(data.result)) return;
|
||||
this._pollFailureCount = 0;
|
||||
|
||||
for (const update of data.result) {
|
||||
this._lastUpdateId = Math.max(this._lastUpdateId, update.update_id);
|
||||
@@ -366,9 +369,14 @@ export class TelegramAlerter {
|
||||
await this._handleMessage(msg);
|
||||
}
|
||||
} catch (err) {
|
||||
// Silent — polling failures are non-fatal
|
||||
this._pollFailureCount++;
|
||||
if (!err.message?.includes('aborted')) {
|
||||
console.error('[Telegram] Poll error:', err.message);
|
||||
const now = Date.now();
|
||||
const quietMs = Math.min(300000, 30000 * this._pollFailureCount);
|
||||
if (now - this._lastPollErrorLogAt > quietMs) {
|
||||
this._lastPollErrorLogAt = now;
|
||||
console.error(`[Telegram] Poll degraded (${this._pollFailureCount} consecutive failures):`, err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user