Conversation
| ipcMain.on('restartClient', () => autoUpdater.quitAndInstall()) | ||
|
|
||
| // get pid/tid on launch and inject | ||
| ipcMain.handle( |
There was a problem hiding this comment.
i basically moved all of this logic out into handleGameLaunch so that we could store the promise in allLaunchHandlerPromises to await on app quit
| } | ||
| } | ||
|
|
||
| export const flushEvents = async () => rudderstack.flush() |
There was a problem hiding this comment.
we have to flush the events in the launch handler so that Game Closed is sent on app close. Otherwise it is added to the cache and will wait a little while to see if there are other events that can be batch sent along with it
| }) | ||
| } | ||
| // Kill all child processes, closing browser and native games that are running | ||
| callAllAbortControllers() |
There was a problem hiding this comment.
this has to be called before the cleanUp function so that that launch handlers can finish executing
| } | ||
|
|
||
| function callAllAbortControllers() { | ||
| for (const key in abortControllers.keys()) { |
There was a problem hiding this comment.
This was causing native games launched through HP to not be closed when HP was closed
| { | ||
| "name": "hyperplay", | ||
| "version": "0.22.1", | ||
| "version": "0.22.2-analytics", |
There was a problem hiding this comment.
just for testing so I can filter for this version on the charts
|
Pretty sensitive code. Will need your review on this one @flavioislima |
flavioislima
left a comment
There was a problem hiding this comment.
Code looks good! left a small comment.
Did some basic testing with Epic and GOG games to check if the sync-saves would work on app close and they are working as they should.
Ideally would be good to test the launch command pretty well just to guarantee nothing is broken on any platform for any runner.
| const allGameLaunchHandlersSettled = Promise.allSettled( | ||
| allLaunchHandlerPromises | ||
| ) | ||
| const oneSecondTimeout = new Promise((res) => { |
There was a problem hiding this comment.
maybe you could use the wait helper method we have here:
Would need to make it accept a string, or make it always return TIME_OUT which is fine as well, if you need the message ofc.
Summary
Give game launch handlers 1 second on main window close to clean up (i.e. sync playsession and send game closed event).
closes https://github.com/HyperPlay-Gaming/PX-PM/issues/21
also fixes an issue where call all abort controllers was not working on main window close
Testing
https://app.qase.io/case/HC-528