I have a async tornado server that calls an async function. However, that function just does some background processing, and I don't want to wait for it to finish. How can I do this? Here is an example of what I have:
@gen.coroutine
def get(self):
yield self.process('data') # I don't want to wait here
self.write('page')
@gen.coroutine
def process(self, arg):
d = yield gen.Task(self.otherFunc, arg)
raise gen.Return(None)
Simply remove the yield before self.process('data'). It will still run, but the get function won't wait for it to finish. Example:
Will give a,c,d,b but:
Can give a,c,b,d or a,b,c,d depending on order execution, but it will no longer wait until process is done to get to 'b'.