mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2026-03-03 07:00:53 +01:00
Update debug logs
This commit is contained in:
@@ -25,7 +25,7 @@ export default class BotsManager {
|
|||||||
// Bots
|
// Bots
|
||||||
static bots: {[key: number]: Telegraf} = {};
|
static bots: {[key: number]: Telegraf} = {};
|
||||||
static botsStates: {[key: number]: BotState} = {};
|
static botsStates: {[key: number]: BotState} = {};
|
||||||
static botsPeddingUpdateCount: {[key: number]: number} = {};
|
static botsPendingUpdatesCount: {[key: number]: number} = {};
|
||||||
|
|
||||||
// Intervals
|
// Intervals
|
||||||
static syncInterval: NodeJS.Timer | null = null;
|
static syncInterval: NodeJS.Timer | null = null;
|
||||||
@@ -53,6 +53,8 @@ export default class BotsManager {
|
|||||||
(value: BotState) => this._checkPendingUpdates(this.bots[value.id], value)
|
(value: BotState) => this._checkPendingUpdates(this.bots[value.id], value)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("Bots pending updates count:", this.botsPendingUpdatesCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,15 +91,13 @@ export default class BotsManager {
|
|||||||
static async _checkPendingUpdates(bot: Telegraf, state: BotState) {
|
static async _checkPendingUpdates(bot: Telegraf, state: BotState) {
|
||||||
try {
|
try {
|
||||||
const webhookInfo = await bot.telegram.getWebhookInfo();
|
const webhookInfo = await bot.telegram.getWebhookInfo();
|
||||||
const previousPendingUpdateCount = this.botsPeddingUpdateCount[state.id] || 0;
|
const previousPendingUpdateCount = this.botsPendingUpdatesCount[state.id] || 0;
|
||||||
|
|
||||||
console.log("Check pending updates:", {state, webhookInfo});
|
|
||||||
|
|
||||||
if (previousPendingUpdateCount !== 0 && webhookInfo.pending_update_count !== 0) {
|
if (previousPendingUpdateCount !== 0 && webhookInfo.pending_update_count !== 0) {
|
||||||
this._setWebhook(bot, state);
|
this._setWebhook(bot, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.botsPeddingUpdateCount[state.id] = webhookInfo.pending_update_count;
|
this.botsPendingUpdatesCount[state.id] = webhookInfo.pending_update_count;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Sentry.captureException(e, {
|
Sentry.captureException(e, {
|
||||||
extra: {
|
extra: {
|
||||||
|
|||||||
Reference in New Issue
Block a user