Closed adamvas closed 3 years ago
I will look at fixing this. However you could use the following instead:
public override Task Shutdown()
{
channel.UnbindAll();
pusherClient.UnsubscribeAsync(channel.Name);
return pusherClient.DisconnectAsync();
}
Please let me know if the above works?
Hi @erwin42 , sure I changed my code to this already. It works as expected, just wanted to highlight it.
Is there any reason behind that Unsubscribe
is not async by default, I mean Task
instead of void
?
We would have removed the function, but we kept it for backwards compatibility. You will notice no mention of the Channel.Unsubscribe
method in the Readme doc. We are trying to discourage people from using the method in favour of Pusher.UnsubscribeAsync
.
I tried to repro your issue but couldn’t. I will leave a test in for it in our next release.
I will add public async Task UnsubscribeAsync()
to the `Channel' class in our next release to help with this issue
hi @adamvas and thanks again for reporting an issue. The async method was added in #112 and released in version 2.1.0
.
Hi, It can casue deadlock if you are unsubscribing from a channel in an async awaited method, like:
eg:
Thats bcs of this:
Blocking async call in a non-blocking async call.
Best practice is usually async all-way-down.