I
I
Ivan2021-12-20 14:25:23
Python
Ivan, 2021-12-20 14:25:23

Why spam warning Connection pool is full, discarding connection: localhost in aiogram?

I ran into a problem, there is a tg bot on aiogram, constantly, even in idle mode, spamming a warning
61c062c161a9e149547643.png
. I didn’t find clear information about what it is for, or how to track it.
And I've only encountered this problem on Linux.
The bot itself launches a browser instance (selenium), which performs N-th work in a thread.

There is an assumption that due to selenium, the pool is somehow blocked:

async def update_cards():
    while True:
        if browsers:
            for key in list(browsers.keys()):
                cards = browsers[key].get_cards()
                await commands.add_card_for_cards(cards=cards[0], account_id=cards[1], user_id=cards[2])
        await asyncio.sleep(30)


async def get_daily_cards():
    while True:
        if browsers:
            for key in list(browsers.keys()):
                cards = browsers[key].get_daily_cards()
                await commands.add_daily_card_for_cards(cards=cards[0], account_id=cards[1])
        await asyncio.sleep(360)


async def on_startup(_):
  await set_commands(bot)
  asyncio.create_task(update_cards())
  asyncio.create_task(get_daily_cards())


if __name__ == '__main__':
  executor.start_polling(dp, skip_updates=True, on_startup=on_startup, allowed_updates=get_handled_updates_list(dp))


If anyone had this problem, how did you solve it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question