Skip to content

Commit 12ba779

Browse files
SNOW-1763096: Fix async telemetry support
1 parent ab5902f commit 12ba779

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/snowflake/connector/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def send_exception_telemetry(
175175
try:
176176
import asyncio
177177

178-
asyncio.get_running_loop().create_task(result)
178+
asyncio.get_running_loop().run_until_complete(result)
179179
except Exception:
180180
logger.debug(
181181
"Failed to schedule async telemetry logging.",

test/unit/aio/test_errors_telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async def test_error_telemetry_async_connection():
2424

2525
with patch("asyncio.get_running_loop") as loop_mock:
2626
Error(msg="kaboom", errno=654321, sqlstate="00000", connection=conn)
27-
loop_mock.return_value.create_task.assert_called_once()
27+
loop_mock.return_value.run_until_complete.assert_called_once()
2828

2929
msg = _extract_message_from_log_call(conn)
3030
assert msg[TelemetryField.KEY_TYPE.value] == TelemetryField.SQL_EXCEPTION.value

0 commit comments

Comments
 (0)