-
Notifications
You must be signed in to change notification settings - Fork 173
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
fix for realtime calling subscription multiple time - Appwrite 1.4.x #713
Conversation
await Future.delayed(Duration.zero, () => _createSocket()); | ||
} else { | ||
await _closeConnection(); | ||
} | ||
}); | ||
_subscriptions[counter] = subscription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using a counter can lead to problems. For example:
- start (counter = 0, subscriptions map is empty)
- subscribe() (counter = 1, subscriptions[0] is set)
- subscribe() (counter = 2, subscriptions[0] and [1] are set)
- the first one gets removed (counter = 1, subscriptions[1] is set)
- a new subscription added (counter = 2, subscriptions[1] is set and replaces the subscription from step 2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've updated to use the time in microseconds to overcome this. please let me know what you think.
ab42f8c
to
a79c32e
Compare
Closing as this is no longer needed. It has been added in later versions. |
What does this PR do?
Test Plan
Related PRs and Issues
Have you read the Contributing Guidelines on issues?
YES