コード例 #1
0
ファイル: api.py プロジェクト: wujm2007/hug
 def _ensure_started(self):
     """Marks the API as started and runs all startup handlers"""
     if not self.started:
         async_handlers = [startup_handler for startup_handler in self.startup_handlers if
                           introspect.is_coroutine(startup_handler)]
         if async_handlers:
             loop = asyncio.get_event_loop()
             loop.run_until_complete(asyncio.gather(*[handler(self) for handler in async_handlers], loop=loop))
         for startup_handler in self.startup_handlers:
             if not startup_handler in async_handlers:
                 startup_handler(self)
コード例 #2
0
ファイル: api.py プロジェクト: zxy-zxy/hug
 def _ensure_started(self):
     """Marks the API as started and runs all startup handlers"""
     if not self.started:
         async_handlers = [startup_handler for startup_handler in self.startup_handlers if
                           introspect.is_coroutine(startup_handler)]
         if async_handlers:
             loop = asyncio.get_event_loop()
             loop.run_until_complete(asyncio.gather(*[handler(self) for handler in async_handlers], loop=loop))
         for startup_handler in self.startup_handlers:
             if not startup_handler in async_handlers:
                 startup_handler(self)