Refactor/fix: Wait until frontend is ready before processing protocol/args #1501
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the current code, we process the protocol/args 3s after Heroic starts, this value is sometimes too much (if heroic starts really fast) and sometimes not enough (in slow computers like my Mac it takes more than those 3 second for the frontend to be ready).
Instead of having that delay, with this PR I added a message from the frontend to the backend to tell it it's ready, and then we process the protocol.
This will also help with issue I had with the desktop shortcut feature on Mac, since I think this was causing the problem described in my comment (my mac being slow taking more than 3 seconds to have the frontend ready) #723
How to Test/QA:
Change the
electron
script in package.json to be something like:Or any installed game, run
yarn electron
.You can set a really small timeout to show what happens if that runs before the frontend is ready in the code without this fix.
Use the following Checklist if you have changed something on the Backend or Frontend: