Async utilities#

commons.async_util.create_task(*args, task_id=None, **kwargs) Task#

Creates a task while maintain a background reference, so they don’t get de-reffed

Parameters:

task_id

A unique variable to store tasks under

If None, uses random.randbytes(4)

async commons.async_util.maybe_coro(func, *args, **kwargs)#

Call the given func, awaiting if required.

Args and Kwargs are passed directly to the coroutine.