-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Unsubscribe from pusher channels if there are no more events subscribed #42447
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-app-2024-05-23_14.03.48.mp4Android: mWeb Chromeandroid-chrome-2024-05-23_14.07.59.mp4iOS: Nativeios-app-2024-05-24_12.18.38.mp4iOS: mWeb Safariios-safari-2024-05-24_12.12.47.mp4MacOS: Chrome / Safaridesktop-chrome-2024-05-23_12.02.56.mp4MacOS: Desktopdesktop-app-2024-05-23_12.41.39.mp4 |
Found a way to repro this without needing to close the laptop lid/sleep:
|
This comment was marked as resolved.
This comment was marked as resolved.
Ah looks like I just had some pusher subscriptions lying around. Signing out and back in resolved the above. |
BUG: Opening a workspace chat via the header in an IOU report doesn't unsubscribe from the IOU report's channel. These subscriptions then build up over time, so you can end up with a ton of
desktop-chrome-2024-05-23_12.09.53.mp4 |
Looks like this is caused by the fact that we only unbind from the |
I agree, that makes sense to deal with in a separate issue imo, because it's not caused by this. Good testing though! |
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.
LGTM!
We have a similar problem as the one @jjcoffee described if we go back in the browser stack
We can handle this in the same issue we are handling the other problem I guess? |
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.
Code looks good!
requested merge: https://expensify.slack.com/archives/C07J32337/p1716568763287419 |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.4.76-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.76-7 🚀
|
Details
While we had code in place to unsubscribe from events and from whole channels/sockets, we were only ever unsubscribing from events (look for usages of
Pusher.unsubscribe
).This means that for every report channel we subscribed to, we remained subscribed to the channel even if we had no event handlers registered for that event.
This is a problem because it leads to many, many duplicate
AuthenticatePusher
calls when you're re-opening NewDot, and along with those many unnecessary websocket connections.Fixed Issues
$ #42489
PROPOSAL: https://expensify.slack.com/archives/C05LX9D6E07/p1716406444259199?thread_ts=1716338088.626339&cid=C05LX9D6E07
Tests / QA Steps
Open the JS console. Filter the console logs for
[Pusher]
Click through four different reports.
Verify that you see a log line like:
Open the network tab of the chrome dev tools. Filter for
AuthenticatePusher
and clear the network requests.Close your laptop and wait 5-10 seconds. Or if you're using a desktop computer put it to sleep.
Open your laptop back up and reopen NewDot.
Verify that you see only four
AuthenticatePusher
requests, and not more.Offline tests
n/a
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Important
these test steps are impossible to fully capture with a screen recording since they involve putting your laptop to sleep. Please test thoroughly nonetheless 🙂)
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov
MacOS: Desktop