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

Login improvement #8306

Merged
merged 7 commits into from
Nov 13, 2024
Merged

Login improvement #8306

merged 7 commits into from
Nov 13, 2024

Conversation

enahum
Copy link
Contributor

@enahum enahum commented Nov 1, 2024

Summary

Currently signing in into a server that has many teams and threads can take a long time, this was mostly because of some await calls in the entry actions, specially around fetching the threads for teams.

So in this PR we are refactoring the code a bit, first to defer some of the actions by pushing them to another event loop as well as changing some code to optimize certain things. Also in addition we introduced mattermost/mattermost#29042 so that we don't need to fetch the DM / GM threads for every team at start time as they are the same for every team and we can leave that sync to an on demand kind of scenario.

Note: This PR needs updating once mattermost/react-native-network-client#134 has been merged and released.

Ticket Link

Part of https://mattermost.atlassian.net/browse/MM-58384

Checklist

  • Added or updated unit tests (required for all new features)

Environment

This PR was tested on a server with a user that belongs to 85 teams with hundreds of channels

Release Note

Performance improvements when login to a server

@enahum enahum added the 2: Dev Review Requires review by a core commiter label Nov 1, 2024
@enahum enahum requested review from larkox and rahimrahman November 1, 2024 05:10
@@ -6,7 +6,7 @@ import React
@objc private var hasRegisteredLoad = false

deinit {
DispatchQueue.main.async {
DispatchQueue.main.sync {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change fixes a crash when reloading the app in dev mode.

@@ -60,7 +60,7 @@ class NetworkManager {
sessionConfiguration: {
allowsCellularAccess: true,
waitsForConnectivity: false,
httpMaximumConnectionsPerHost: 10,
httpMaximumConnectionsPerHost: 100,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change increases the amount of concurrent requests that can be perform for each server, specially significant on Android

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the changes here address the concern from @hmhealey in #8281

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

LGTM. Just some minor comments.

app/actions/remote/post.ts Outdated Show resolved Hide resolved
app/actions/remote/thread.ts Outdated Show resolved Hide resolved
app/actions/remote/entry/common.ts Outdated Show resolved Hide resolved
@enahum enahum requested a review from larkox November 4, 2024 12:19
@amyblais amyblais added this to the v2.23.0 milestone Nov 5, 2024
@enahum enahum mentioned this pull request Nov 5, 2024
@enahum
Copy link
Contributor Author

enahum commented Nov 10, 2024

@rahimrahman how are we with the review?

@amyblais amyblais added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Nov 12, 2024
@enahum enahum added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Nov 13, 2024
@enahum enahum merged commit ea2cb45 into main Nov 13, 2024
20 checks passed
@mattermost-build
Copy link
Contributor

Cherry pick is scheduled.

@enahum enahum deleted the login-improvement branch November 13, 2024 00:06
mattermost-build pushed a commit that referenced this pull request Nov 13, 2024
* refactor to improve requests on login

* include in team sidebar order by display name teams not present in the order preference

* Fix iOS reload while developing

* fix code causing tests to fail

* feedback review

* update network-client

(cherry picked from commit ea2cb45)
@mattermost-build mattermost-build added the CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone label Nov 13, 2024
@mattermost-build mattermost-build removed the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Nov 13, 2024
enahum added a commit that referenced this pull request Nov 13, 2024
* refactor to improve requests on login

* include in team sidebar order by display name teams not present in the order preference

* Fix iOS reload while developing

* fix code causing tests to fail

* feedback review

* update network-client

(cherry picked from commit ea2cb45)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone kind/refactor release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants