Check if the current event loop matches the one this client was created on.
(self)
| 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.""" |