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

feat: Store user's metadata in database [FS-1828] #15002

Merged
merged 18 commits into from
Apr 12, 2023
Merged

Conversation

atomrc
Copy link
Contributor

@atomrc atomrc commented Apr 12, 2023

Sub-taskFS-1828 [web] Store users in Database and only load unknown users

This will make sure that we download a user only once.

  • at first start, all the users will be downloaded and stored into the database
  • at subsequent loads, only the users that are listed (in connections or team members) that we do not have locally will be downloaded
  • when a user is updated (via a websocket user.update message), we update the in-memory user and the database entry

This will:

  • speedup webapp loading time (since all connections and team members won't be downloaded anymore)
  • allow better offline support

@atomrc atomrc changed the title feat: Store user's metadata in database feat: Store user's metadata in database [FS-1828] Apr 12, 2023
@atomrc atomrc marked this pull request as ready for review April 12, 2023 13:34
@atomrc atomrc requested review from a team and otto-the-bot as code owners April 12, 2023 13:34
Comment on lines +395 to +401
const {members: teamMembers} = await teamRepository.initTeam(selfUser.teamId);
telemetry.timeStep(AppInitTimingsStep.RECEIVED_USER_DATA);

const connections = await connectionRepository.getConnections();
telemetry.addStatistic(AppInitStatisticsValue.CONNECTIONS, connections.length, 50);

await userRepository.loadUsers(connections, [...teamMembers, selfUser.qualifiedId]);
Copy link
Contributor Author

@atomrc atomrc Apr 12, 2023

Choose a reason for hiding this comment

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

This is the major change here. Now getConnections and initTeam do not fetch user's metadata anymore (doing less side-effects).
Instead they return the userIds that needs to be loaded later on

The userRepository.loadUsers is responsible for loading the users from the DB and fetch the missing users on backend

@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Merging #15002 (577622e) into dev (9a12711) will increase coverage by 0.16%.
The diff coverage is 50.71%.

@@            Coverage Diff             @@
##              dev   #15002      +/-   ##
==========================================
+ Coverage   43.12%   43.29%   +0.16%     
==========================================
  Files         641      642       +1     
  Lines       21545    21543       -2     
  Branches     4935     4932       -3     
==========================================
+ Hits         9292     9327      +35     
+ Misses      11066    11029      -37     
  Partials     1187     1187              

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants