Skip to content

Bug fix: suspend extension function remains suspended if the request is cancelled#574

Merged
philips77 merged 1 commit intonordicsemi:mainfrom
muscardinus:fix-cancellation-in-suspend
Aug 16, 2024
Merged

Bug fix: suspend extension function remains suspended if the request is cancelled#574
philips77 merged 1 commit intonordicsemi:mainfrom
muscardinus:fix-cancellation-in-suspend

Conversation

@muscardinus
Copy link
Copy Markdown
Contributor

The suspend() extension functions on various Request types will ignore the cancellation instead of throwing an exception when cancelled via a mechanism other then cancelling the coroutine.

In such cases the code that calls suspend() will remain suspended indefinitely.

An example of this is:
Call connect from one coroutine (from within a BleManager):

connect(bluetoothDevice)
    .suspend()

While the connect is in progress (within 30 seconds) and before it could succeed, call from another place in the code:

cancelQueue()

While the connection gets cancelled, the first call will remain suspended.

This PR is an attempt to fix the problem.

@philips77 philips77 merged commit 3815e66 into nordicsemi:main Aug 16, 2024
@muscardinus muscardinus deleted the fix-cancellation-in-suspend branch August 19, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants