Exemple #1
0
def spawn_sync(coro, *args, loop=None, report_crash=True):
    coro = instantiate_coroutine(coro, args)
    loop = loop or get_event_loop()
    task = loop.create_task(coro)
    if report_crash:
        task.add_done_callback(partial(check_task, logging))
    return task
Exemple #2
0
def spawn_sync(coro, *args, loop=None, daemon=False):
    coro = instantiate_coroutine(coro, args)
    loop = loop or get_event_loop()
    task = loop.create_task(coro)
    task._daemon = daemon
    return task
Exemple #3
0
async def _ignore_after_func(seconds, absolute, coro, args, timeout_result):
    coro = instantiate_coroutine(coro, args)
    async with TimeoutAfter(seconds, absolute=absolute, ignore=True):
        return await coro

    return timeout_result
Exemple #4
0
async def _timeout_after_func(seconds, absolute, coro, args):
    coro = instantiate_coroutine(coro, args)
    async with TimeoutAfter(seconds, absolute=absolute):
        return await coro