MCPcopy
hub / github.com/tortoise/tortoise-orm / _check_loop

Method _check_loop

tortoise/backends/base/client.py:136–144  ·  view source on GitHub ↗

Check if the current event loop matches the one this client was created on.

(self)

Source from the content-addressed store, hash-verified

134 self.fetch_inserted = fetch_inserted
135
136 def _check_loop(self) -> bool:
137 """Check if the current event loop matches the one this client was created on."""
138 try:
139 current = asyncio.get_running_loop()
140 except RuntimeError:
141 return True # No running loop — can't validate
142 if self._bound_loop is None:
143 return True # Not yet bound (pool not created yet)
144 return self._bound_loop is current
145
146 async def _post_connect(self) -> None:
147 """Called after pool/connection is created. Records the bound loop."""

Callers 1

getMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected