Skip to content

Instantly share code, notes, and snippets.

@wynemo
Created March 24, 2025 03:35
Show Gist options
  • Save wynemo/4f8a7baea20e483b7e72a903d4d68bf3 to your computer and use it in GitHub Desktop.
Save wynemo/4f8a7baea20e483b7e72a903d4d68bf3 to your computer and use it in GitHub Desktop.

Hello everyone, have you encountered this error?

 2025-03-24 11:23:17,213 - telegram.ext.ExtBot - DEBUG - Calling Bot API endpoint `getUpdates` with parameters `{'timeout': 10, 'offset': 894837147}`
2025-03-24 11:23:22,217 - telegram.ext.Updater - DEBUG - Timed out getting Updates: Pool timeout: All connections in the connection pool are occupied. Request was *not* sent to Telegram. Consider adjusting the connection pool size or the pool timeout.
2025-03-24 11:23:22,220 - telegram.ext.ExtBot - DEBUG - Calling Bot API endpoint `getUpdates` with parameters `{'timeout': 10, 'offset': 894837147}`
2025-03-24 11:23:27,226 - telegram.ext.Updater - DEBUG - Timed out getting Updates: Pool timeout: All connections in the connection pool are occupied. Request was *not* sent to Telegram. Consider adjusting the connection pool size or the pool timeout.
2025-03-24 11:23:27,230 - telegram.ext.ExtBot - DEBUG - Calling Bot API endpoint `getUpdates` with parameters `{'timeout': 10, 'offset': 894837147}`
2025-03-24 11:23:32,235 - telegram.ext.Updater - DEBUG - Timed out getting Updates: Pool timeout: All connections in the connection pool are occupied. Request was *not* sent to Telegram. Consider adjusting the connection pool size or the pool timeout.

It looks like the code is stuck in this while loop:

    while effective_is_running():
        try:
            if not await do_action():
                break
        except RetryAfter as exc:
            slack_time = 0.5
            _LOGGER.info(
                "%s %s. Adding %s seconds to the specified time.", log_prefix, exc, slack_time
            )
            cur_interval = slack_time + exc.retry_after
        except TimedOut as toe:
            _LOGGER.debug("%s Timed out: %s. Retrying immediately.", log_prefix, toe)
            # If failure is due to timeout, we should retry asap.
            cur_interval = 0
        #
        if cur_interval:
            await asyncio.sleep(cur_interval)

here is my code:

    application = Application.builder().token(TOKEN).build()

    application.add_handler(CommandHandler("start", start))
    application.add_handler(CommandHandler("search", handle_mention))
    application.add_handler(CommandHandler("fetch", handle_mention))
    application.add_handler(CommandHandler("mars", handle_mars))
    application.add_handler(CommandHandler("youtube", handle_youtube))
    application.add_handler(
        MessageHandler(filters.TEXT & ~filters.COMMAND, handle_mention, block=False)
    )
    application.add_handler(
        MessageHandler(filters.TEXT & filters.Entity("mention"), handle_mention, block=False)
    )

    application.add_error_handler(error_handler)

    application.run_polling()

any suggestion,please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment