-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Allow priority requests to go to the front of the sequential queue #23669
Changes from 13 commits
e6ab4fa
4149570
8bff72f
dab8582
297c792
1abb3ff
276ad1e
38a5261
4b25d33
0d1f2a7
0708d43
b9c2781
c15730d
f89a71e
9cc2132
338618d
fb3ba07
b853201
2bd30e8
35bb482
09c7327
f17e3f3
021e41b
d77564c
6a25f77
2eb7c87
7934f37
636f26c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ import * as ReportActionsUtils from '../ReportActionsUtils'; | |
import * as ErrorUtils from '../ErrorUtils'; | ||
import * as Session from './Session'; | ||
import * as PersonalDetails from './PersonalDetails'; | ||
import * as App from './App'; | ||
import Log from '../Log'; | ||
|
||
let currentUserAccountID = ''; | ||
let currentEmail = ''; | ||
|
@@ -41,6 +43,12 @@ Onyx.connect({ | |
}, | ||
}); | ||
|
||
let onyxUpdatesLastUpdateID; | ||
Onyx.connect({ | ||
key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID, | ||
callback: (val) => (onyxUpdatesLastUpdateID = val), | ||
}); | ||
|
||
/** | ||
* Attempt to close the user's account | ||
* | ||
|
@@ -558,15 +566,29 @@ function subscribeToUserEvents() { | |
// until we finish the migration to reliable updates. So let's check it before actually updating | ||
// the properties in Onyx | ||
if (pushJSON.lastUpdateID && pushJSON.previousUpdateID) { | ||
console.debug('[OnyxUpdates] Received lastUpdateID from pusher', pushJSON.lastUpdateID); | ||
console.debug('[OnyxUpdates] Received previousUpdateID from pusher', pushJSON.previousUpdateID); | ||
// Store these values in Onyx to allow App.reconnectApp() to fetch incremental updates from the server when a previous session is being reconnected to. | ||
Onyx.multiSet({ | ||
[ONYXKEYS.ONYX_UPDATES.LAST_UPDATE_ID]: Number(pushJSON.lastUpdateID || 0), | ||
[ONYXKEYS.ONYX_UPDATES.PREVIOUS_UPDATE_ID]: Number(pushJSON.previousUpdateID || 0), | ||
}); | ||
const pushJSONLastUpdateID = Number(pushJSON.lastUpdateID || 0); | ||
const pushJSONPreviousUpdateID = Number(pushJSON.previousUpdateID || 0); | ||
|
||
console.debug('[OnyxUpdates] Received lastUpdateID from pusher', pushJSONLastUpdateID); | ||
console.debug('[OnyxUpdates] Received previousUpdateID from pusher', pushJSONPreviousUpdateID); | ||
console.debug('[OnyxUpdates] The lastUpdateID the client received was', onyxUpdatesLastUpdateID); | ||
|
||
// Store this value in Onyx to allow AuthScreens to fetch incremental updates from the server when a previous session is being reconnected to. | ||
Onyx.set(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID, pushJSONLastUpdateID); | ||
|
||
// The previous update from the server does not match the last update the client got which means the client is missing some updates. | ||
// ReconnectApp will fetch updates starting from the last update this client got and going to the last update the server sent. | ||
if (onyxUpdatesLastUpdateID < pushJSONPreviousUpdateID) { | ||
console.debug('[OnyxUpdates] Gap detected in update IDs so fetching incremental updates'); | ||
Log.info('Gap detected in update IDs from Pusher so fetching incremental updates', true, { | ||
lastUpdateIDFromPusher: pushJSONLastUpdateID, | ||
previousUpdateIDFromPusher: pushJSONPreviousUpdateID, | ||
lastUpdateIDOnClient: onyxUpdatesLastUpdateID, | ||
}); | ||
App.reconnectApp(onyxUpdatesLastUpdateID, pushJSONLastUpdateID, true); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tgolen I think you missed this, but you created a GetMissingOnyxMessages method in the API to use exactly on this situation instead of using ReconnectApp. I think we should use it here for clarity. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I will switch to using this. |
||
} else { | ||
console.debug('[OnyxUpdates] No lastUpdateID and previousUpdateID provided'); | ||
console.debug('[OnyxUpdates] No lastUpdateID and previousUpdateID provided from Pusher'); | ||
} | ||
} | ||
_.each(updates, (multipleEvent) => { | ||
|
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.
Just for clarity, I was confused if this was the one I received or the one we had when just looking at the logs
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.
I will update!