We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5712e9e commit 77d922bCopy full SHA for 77d922b
1 file changed
google/cloud/sql/connector/connector.py
@@ -266,6 +266,15 @@ async def connect_async(
266
DnsNameResolutionError: Could not resolve PSC IP address from DNS
267
host name.
268
"""
269
+ # check if event loop is running in current thread
270
+ if self._loop != asyncio.get_running_loop():
271
+ raise ConnectorLoopError(
272
+ "Running event loop does not match 'connector._loop'. "
273
+ "Connector.connect_async() must be called from the event loop "
274
+ "the Connector was initialized with. If you need to connect "
275
+ "across event loops/threads please use a new Connector object."
276
+ )
277
+
278
if self._keys is None:
279
self._keys = asyncio.create_task(generate_keys())
280
if self._client is None:
0 commit comments