Closed BryceBarbara closed 3 years ago
If you never Subscribe
, you don't have to call Revoke
. You just de-reference it and it will be garbage collected by .NET runtime.
You can see that the constructor doesn't consume any system/network resource: https://github.com/ringcentral/RingCentral.Net/blob/7635cc8e4d34639dab4751f9ddc333f1d47a86cd/RingCentral.Net.PubnubPCL/Subscription.cs#L45-L57. So there is nothing to revoke.
But I get your point, it's better to add some sanity check and do nothing to revoke if there is nothing to revoke.
I'm trying to cancel a subscription that was started in another instance that fatally exited. I've found that if I don't cancel it in advance, I get duplicate notifications.
There's currently no way to cancel the orphaned subscriptions with the system as it stands.
I'm trying to cancel a subscription that was started in another instance that fatally exited.
What do you mean by "fatally exited"? And what is "another instance"? Do you mean another app process or another subscription object?
There's currently no way to cancel the orphaned subscriptions with the system as it stands.
There is, as long as you have the subscription ID. You just invoke this https://github.com/ringcentral/RingCentral.Net/blob/7635cc8e4d34639dab4751f9ddc333f1d47a86cd/RingCentral.Net.PubnubPCL/Subscription.cs#L101
You cannot invoke pubnub.Destroy because in your case for some reason pubnub is null. (which I think is because you never subscribed, but you said it is because instance fatally exited)
In latest version, code has been changed to _pubnub?.Revoke()
which will not throw if _pubnub
is null.
As the title says, you can't currently cancel a subscription when you have the
SubscriptionInfo
object for it although it seems like you should.Here's some example code explaining the scenario I'm trying to do:
Although I'm not positive, it looks like this might be the problem line: https://github.com/ringcentral/RingCentral.Net/blob/7635cc8e4d34639dab4751f9ddc333f1d47a86cd/RingCentral.Net.PubnubPCL/Subscription.cs#L115