Skip to content

Commit 01a7d5f

Browse files
committed
chore: fix a01 client
cleanup
1 parent f748b18 commit 01a7d5f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_a01_api.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
from .conftest import QUEUE_TIMEOUT
3838

3939

40+
RELEASE_TIMEOUT = 2
41+
42+
4043
@pytest.fixture(name="a01_mqtt_client")
4144
async def a01_mqtt_client_fixture(
4245
mock_create_connection: None, mock_select: None
@@ -59,9 +62,11 @@ async def a01_mqtt_client_fixture(
5962
try:
6063
yield client
6164
finally:
62-
if not client.is_connected():
65+
# Cleanup is best effort to reduce number of active threads
66+
if client.is_connected():
6367
try:
64-
await client.async_release()
68+
async with asyncio.timeout(RELEASE_TIMEOUT):
69+
await client.async_release()
6570
except Exception:
6671
pass
6772

0 commit comments

Comments
 (0)