Skip to content

Call dispatcher.update_queue.task_done() after handler execution finished? #1410

@alesdakshanin

Description

@alesdakshanin

I couldn't find any calls of update_queue.task_done() in the codebase.

You can use the following handler to demonstrate the problem - it returns incrementing numbers:

def echo(bot, update):
    reply_text = f"Unfinished tasks: {bot.dispatcher.update_queue.unfinished_tasks}"
    bot.send_message(chat_id=update.message.chat_id, text=reply_text)

I personally would really like to know whether my bot is resting and all jobs are completed. It could help me to properly exit from a serverless handler.

Is there any reason why task_done() is never called? If there isn't, what would be the best place to put that logic in? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions