Skip to content

FireAndForget

fire_and_forget(f)

run it and forget it

Source code in API/authenticate/utils/fire_and_forget.py
 4
 5
 6
 7
 8
 9
10
11
12
def fire_and_forget(f):
    """run it and forget it"""

    def wrapped(*args, **kwargs):
        loop = asyncio.new_event_loop()
        loop.run_in_executor(None, f, *args, *kwargs)
        loop.close()

    return wrapped