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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated watching channel calls when reconnecting #3187

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented May 8, 2024

馃敆 Issue Links

Resolves https://github.com/GetStream/ios-issues-tracking/issues/800

馃幆 Goal

Fix having duplicated watching channel calls after reconnection logic.

Context: Whenever we reconnect, if the user is watching channels, we track these channels and re-watch them.

馃摑 Summary

This was because we were incorrectly adding a channel controller to activeChannelControllers whenever we created a controller. This is wrong; we should only add it when we call synchronize or start watching a channel. Only in this scenario do we need to track a channel.

Besides this, we did not control whether we already had a channel in the activeChannelControllers. So, there were cases where we had duplicated active channel controllers, and whenever a reconnection happened, it would trigger duplicated watch calls.

Lastly, even if a channel is open, if the customer stops watching the channel, it should not be in the activeChannelControllers. This was also missing.

馃И Manual Testing Notes

1- Open Proxyman
2- Open Demo App Configuration and setup token refresh with 15s
3- Open the Channel List
4- Wait for reconnection
5- No channel query call should be made (Do not confuse with channel list call)
6- Open and close a few channels
7- 4. and 5.
8- Open a channel, and remain open
9- When reconnecting the a watch call should be made for the open channel

鈽戯笍 Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero 鈿狅笍 policy (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

@nuno-vieira nuno-vieira added 馃悶聽Bug An issue or PR related to a bug 馃寪聽SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels May 8, 2024
@nuno-vieira nuno-vieira requested a review from a team as a code owner May 8, 2024 17:06
@nuno-vieira nuno-vieira changed the title Fix triggering duplicated watching channel calls when reconnecting Fix duplicated watching channel calls when reconnecting May 8, 2024
@Stream-iOS-Bot
Copy link
Collaborator

StreamChat XCMetrics

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 10.01 ms -0.1% 馃斀 馃煛
Duration 2.6 s 2.54 s 2.31% 馃敿 馃煝
Hitch time ratio 4 ms per s 3.94 ms per s 1.5% 馃敿 馃煝
Frame rate 79 fps 78.15 fps 1.08% 馃敿 馃煝
Number of hitches 1 1.2 -20.0% 馃斀 馃敶
ChannelList Hitches total duration 12.5 ms 18.36 ms -46.88% 馃斀 馃敶
Duration 2.6 s 2.54 s 2.31% 馃敿 馃煝
Hitch time ratio 5 ms per s 7.23 ms per s -44.6% 馃斀 馃敶
Frame rate 76 fps 73.99 fps 2.64% 馃敿 馃煝
Number of hitches 1.2 1.6 -33.33% 馃斀 馃敶

Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find 馃憣

@nuno-vieira nuno-vieira merged commit c0c99ee into develop May 9, 2024
13 of 14 checks passed
@nuno-vieira nuno-vieira deleted the fix/triggering-duplicated-watching-channel-calls-when-reconnecting branch May 9, 2024 10:25
@laevandus laevandus mentioned this pull request May 13, 2024
@laevandus
Copy link
Contributor

I manually verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃悶聽Bug An issue or PR related to a bug 馃寪聽SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants