-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web/lib/keyserver] avoid out of sync
updatesCurrentAsOf
between cl…
…ient and keyserver Summary: This is fix to issue described in: [ENG-5906](https://linear.app/comm/issue/ENG-5906/web-app-stuck-in-crash-loop-even-after-refreshing#comment-11a5f277). In D9948 I started to persist `updatesCurrentAsOf`. I also updated `setInitialReduxState` action to rely on rehydrated data when it's a staff user. What I missed is updating `currentAsOfPromise`, which for `updatesCurrentAsOf` was using server time [here](https://github.com/CommE2E/comm/blob/f4e61ed90d7f972909d2372a397ee3da5fdbd17e/keyserver/src/responders/redux-state-responders.js#L306). This means that after reloading the app, the client (staff) has its own `updatesCurrentAsOf` from the previously received update (previous session) while the keyserver has newer `updatesCurrentAsOf` created while returning the initial state version. This causes [this condition](https://github.com/CommE2E/comm/blob/f4e61ed90d7f972909d2372a397ee3da5fdbd17e/keyserver/src/socket/session-utils.js#L340C10-L340C10) to be `true`, and as a result was causing `FULL_STATE_SYNC` [here](https://github.com/CommE2E/comm/blob/f4e61ed90d7f972909d2372a397ee3da5fdbd17e/keyserver/src/socket/socket.js#L510C19-L510C19) which on prod kills the socket because of the amount of data to transfer. This diff should make `updatesCurrentAsOf` synced between client and server. This also fixes issue described [here](https://linear.app/comm/issue/ENG-5906/web-app-stuck-in-crash-loop-even-after-refreshing#comment-92c744ce). Previously, when `updatesCurrentAsOf` was just started to be persisted, it gets rehydrated with `undefined/0` value, this means after loading app all updates were started to be fetched. Right now if `updatesCurrentAsOf` is `0` we fetch everything in `InitialReduxStateResponder` and set `updatesCurrentAsOf` as `serverTime`. This is only for staff, for standard users everything should work as previously. Test Plan: 1. Reload app and make sure that there is no `FULL_STATE_SYNC`. 2. Make sure updates work properly. 3. Make sure `updatesCurrentAsOf` has correct value. 4. Make sure policies logic (which is related to `updatesCurrentAsOf` value) works. Reviewers: inka, tomek, michal Reviewed By: inka, michal Subscribers: ashoat Differential Revision: https://phab.comm.dev/D10070
- Loading branch information
Showing
6 changed files
with
61 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters