Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lohanidamodar
Copy link
Member

@lohanidamodar lohanidamodar commented Sep 7, 2023

What does this PR do?

  • Fixes issue with calling subscribe multiple times
  • Not syncing with main so this remains, if we want to release Flutter SDK with this fix for Appwrite 1.4.x
  • For latest PR check: fix for realtime multiple subscription 15x #801
  • We shouldn't merge this, rather use this if we want to release (as main has few new features I think not suitable for generating with spec for 1.4.x) if not we can close this issue

Test Plan

  • Manually testing the generated SDK

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

YES

@lohanidamodar lohanidamodar changed the title fix for realtime multiple subscription fix for realtime calling subscription multiple time Sep 7, 2023
await Future.delayed(Duration.zero, () => _createSocket());
} else {
await _closeConnection();
}
});
_subscriptions[counter] = subscription;
Copy link
Contributor

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:

  1. start (counter = 0, subscriptions map is empty)
  2. subscribe() (counter = 1, subscriptions[0] is set)
  3. subscribe() (counter = 2, subscriptions[0] and [1] are set)
  4. the first one gets removed (counter = 1, subscriptions[1] is set)
  5. a new subscription added (counter = 2, subscriptions[1] is set and replaces the subscription from step 2)

Copy link
Member Author

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.

@lohanidamodar lohanidamodar changed the title fix for realtime calling subscription multiple time fix for realtime calling subscription multiple time - Appwrite 1.4.x Mar 14, 2024
@lohanidamodar lohanidamodar changed the base branch from master to 1.4.x March 14, 2024 02:08
@lohanidamodar lohanidamodar changed the base branch from 1.4.x to master March 14, 2024 02:08
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.

None yet

2 participants