Skip to content

fix for realtime calling subscription multiple time - Appwrite 1.4.x#713

Closed
lohanidamodar wants to merge 6 commits into
masterfrom
fix-flutter-realtime-multisub
Closed

fix for realtime calling subscription multiple time - Appwrite 1.4.x#713
lohanidamodar wants to merge 6 commits into
masterfrom
fix-flutter-realtime-multisub

Conversation

@lohanidamodar

@lohanidamodar lohanidamodar commented Sep 7, 2023

Copy link
Copy Markdown
Member

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 _closeConnection();
}
});
_subscriptions[counter] = subscription;

Copy link
Copy Markdown
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
Copy Markdown
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
@lohanidamodar
lohanidamodar force-pushed the fix-flutter-realtime-multisub branch from ab42f8c to a79c32e Compare March 14, 2024 02:11
@lohanidamodar
lohanidamodar requested a review from abnegate March 14, 2024 02:12
@stnguyen90

Copy link
Copy Markdown
Contributor

Closing as this is no longer needed. It has been added in later versions.

@stnguyen90 stnguyen90 closed this Aug 27, 2024
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.

2 participants