def __init__(self, session, home): self.scrapper = Scrapper(session, home) self.session = session self.home = home self.condition = Condition() tornado.ioloop.IOLoop.current()\ .spawn_callback(self.main)
class GameScrapperWorker(object): def __init__(self, session, home): self.scrapper = Scrapper(session, home) self.session = session self.home = home self.condition = Condition() tornado.ioloop.IOLoop.current()\ .spawn_callback(self.main) @tornado.gen.coroutine def main(self): _log().info('scrapper sleeping') yield self.condition.wait() _log().info('scrapper woke up') self.scrapper.scrap_missing() tornado.ioloop.IOLoop.current()\ .spawn_callback(self.main) raise tornado.gen.Return(False)