MCPcopy Index your code
hub / github.com/hugapi/hug / _ensure_started

Method _ensure_started

hug/api.py:623–638  ·  view source on GitHub ↗

Marks the API as started and runs all startup handlers

(self)

Source from the content-addressed store, hash-verified

621 self.startup_handlers.append(handler)
622
623 def _ensure_started(self):
624 """Marks the API as started and runs all startup handlers"""
625 if not self.started:
626 async_handlers = [
627 startup_handler
628 for startup_handler in self.startup_handlers
629 if introspect.is_coroutine(startup_handler)
630 ]
631 if async_handlers:
632 loop = asyncio.get_event_loop()
633 loop.run_until_complete(
634 asyncio.gather(*[handler(self) for handler in async_handlers], loop=loop)
635 )
636 for startup_handler in self.startup_handlers:
637 if not startup_handler in async_handlers:
638 startup_handler(self)
639
640 @property
641 def startup_handlers(self):

Callers 4

test_startupFunction · 0.80
serverMethod · 0.80
__call__Method · 0.80
__call__Method · 0.80

Calls

no outgoing calls

Tested by 1

test_startupFunction · 0.64