-
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
[No QA] Add support for Pusher responses #9219
Conversation
function getCurrentRequest() { | ||
if (currentRequest === null) { | ||
return Promise.resolve(); | ||
} |
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.
NAB, could also initialize/reset with a Promise.resolve()
but this works.
@@ -11,4 +11,6 @@ export default { | |||
PREFERRED_LOCALE: 'preferredLocale', | |||
EXPENSIFY_CARD_UPDATE: 'expensifyCardUpdate', | |||
SCREEN_SHARE_REQUEST: 'screenshareRequest', | |||
ONYX_API_UPDATE: 'onyxApiUpdate', | |||
ONYX_API_UPDATE_CHUNK: 'chunked-onyxApiUpdate', |
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.
After these changes we won't need the prepend chunked to channel names.
cc @danieldoglas to confirm
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.
Oh nice! That one seems fully approved, so it should be merging today, right @alex-mechler? I can update this then :)
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 self merged it, since all reviewers had approved!
That said, we still need the chunked-
channel to be listened to for now, since Web-E will still be sending them until we make the changes to stop sending them. That is HELD on the linked PR getting deployed to production.
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 guess we can move ahead with this PR as-is and remove that afterwards?
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.
Yup, that sounds fine. I have to remove the other chunked-
channels later from this repo anyways.
src/libs/Pusher/pusher.js
Outdated
} | ||
|
||
function onPusherResubscribeToPrivateUserChannel() { | ||
NetworkConnection.triggerReconnectionCallbacks('Pusher re-subscribed to private user channel'); |
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.
opinion (non-blocking): It stuck out to me that the Pusher library is now triggering and aware of the reconnection callbacks. Feels like it now has extra responsibility it should not have. I would maybe put this into something like a PusherUtils
or just have it in User
eventually (after the usages in Report.js
are cleaned up). But not sure we need to do this now.
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.
Hmmm. User
seems like a weird place to me, but creating PusherUtils may be a good idea. Do we expect to create more stuff that would go in there?
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.
Do we expect to create more stuff that would go in there?
Unsure, but I suspect that this subscription will eventually be moved into something like a "User Logged In" or "App Initialized" action since it will happen every time the app starts up.
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 like putting it into PusherUtils
👍
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.
Moved!
src/libs/Pusher/pusher.js
Outdated
} | ||
|
||
function onPusherResubscribeToPrivateUserChannel() { | ||
NetworkConnection.triggerReconnectionCallbacks('Pusher re-subscribed to private user channel'); |
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 like putting it into PusherUtils
👍
OFF HOLD and comments addressed! |
@marcaaron all yours |
🚀 |
✋ 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 @marcaaron in version: 1.1.72-0 🚀
|
🚀 Deployed to production by @yuwenmemon in version: 1.1.73-2 🚀
|
Log.hmmm('[Report] Failed to subscribe to Pusher channel', false, {error, pusherChannelName, eventName}); | ||
} | ||
|
||
Pusher.subscribe(pusherChannelName, eventName, onEventPush, onPusherResubscribeToPrivateUserChannel) |
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.
Here there was not the isChunked
but in the reportUtils it is back.
@@ -302,6 +304,18 @@ function subscribeToUserEvents() { | |||
|
|||
const pusherChannelName = `private-encrypted-user-accountID-${currentUserAccountID}${CONFIG.PUSHER.SUFFIX}`; | |||
|
|||
// Receive any relevant Onyx updates from the server | |||
PusherUtils.subscribeToPrivateUserChannelEvent(Pusher.TYPE.ONYX_API_UPDATE, currentUserAccountID, (pushJSON) => { | |||
SequentialQueue.getCurrentRequest().then(() => { |
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.
Hey everyone 👋🏼 I know it's been a little while, but can someone explain why we needed to add SequentialQueue.getCurrentRequest()
here? It's not clear to me what it's doing.
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.
The first I heard about it you were the one proposing it 😄
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 think I understand why this was added now, I tried to summarize it as concisely as possible here
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.
It was always a longer goal of mine to add a NETWORK.md
and that explanation would be perfect for it (or added as a comment here).
Details
We haven't migrated any commands yet, so we need to add some changes in Web to test this.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/211236
Tests