Skip to content

Task timeouts #87

@chrisguidry

Description

@chrisguidry

Using a timeout as a dependency opens up some interesting use cases for bumping that timeout periodically through the execution of the task, almost like a mini heartbeat:

async def my_long_running_task(
    timeout: Timeout = Timeout(base=timedelta(seconds=10))
) -> None:
    for batch in get_batch_of_work():
        for item in batch:
            do_a_thing(item)
        timeout.extend()   # bumps by another 10 seconds by default

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions