-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restarting client leads to exponential(?) growth of subscriptions #164
Comments
@GrimmiMeloni if it's possible can you share the code block example on how you handle the connection restart? There would be some race conditions so we need to improve the sync lock logic |
Sure, it's anyways all open source. ;) |
@GrimmiMeloni After reading the code, I have a few comments:
Then test again to verify if the duplicated subscription issue still happens. |
Thanks @hgiasac - will do as suggested and follow up here once we have feedback from the field. |
We are observing the following behavior.
Scenario:
Client is connected to a tibber pulse and has a single subscription.
What happens:
Log example
So far so good. Now next:
To my understanding, in this moment flow control given back to the calling code, in our case evcc.
As we need the client to retry connecting, even in situation where the client exits, we do the following:
SubscriptionClient.Subscribe(...)
SubscriptionClient.Run()
I would expect from hereon, the subscription just again does its thing like before, i.e. send an
connection_init
and once successfully subscribed, it just streams the events.However, what we DO see, is a multiplication of the subscription, which I frankly don't understand. So what we see in the logs after calling
.Run()
is a burst of consecutiveconnection_init
requests, which then lead to MULTIPLE subscriptions, where there actually should only be a single subscription.This "pattern" continues, and subscriptions start to pile up. After a few minutes we already have 12 subscriptions, where there used to be a single one.
I am not sure if this is a bug, or if we are doing something wrong on the client side by i.e. reusing the SubscriptionClient. Any advise would be helpful.
The text was updated successfully, but these errors were encountered: