Skip to content

Commit

Permalink
Merge pull request #974 from hbldh/windows-disconnect-timeout
Browse files Browse the repository at this point in the history
backends/winrt/client: extend disconnect timeout
  • Loading branch information
dlech authored Sep 5, 2022
2 parents 9c2b34d + be8da77 commit 6b64f6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
`Unreleased`_
=============

Fixed
-----
Changed
-------
* ``BleakClient`` methods now raise ``BleakError`` if called when not connected in WinRT backend.
* Extended disconnect timeout to 120 seconds in WinRT backend. Fixes #807.

`0.16.0`_ (2022-08-31)
======================
Expand Down
4 changes: 3 additions & 1 deletion bleak/backends/winrt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ async def disconnect(self) -> bool:
self._session_closed_events.append(event)
try:
self._requester.close()
async with async_timeout.timeout(10):
# sometimes it can take over one minute before Windows decides
# to end the GATT session/disconnect the device
async with async_timeout.timeout(120):
await event.wait()
finally:
self._session_closed_events.remove(event)
Expand Down

0 comments on commit 6b64f6f

Please sign in to comment.