My webserver is in my hurricane application. I'm not sure this code is the right way to make asynchronous.
Category MyHandler (WebSocketHandler): def open (self): something ... self.my_coroutine_method () @ gen.coroutine Def my_coroutine_method (auto): user = yield db.user.find_one () # Call motor asynchronous engine itself.write_memory (user)
Yes, this is correct is. However, in some cases, calling without chirotine without learning, exceptions can arise in unexpected ways, so I recommend using the IOLoop.current (). Spawn_callback (self.my_coroutine_method)
In this way non-coroutine.
No comments:
Post a Comment