Skip to content

[FIX] Reload library after GOG game install #3520

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

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Feb 4, 2024

After installing a GOG game, the library is not updated with the new status.

We need to trigger a library refresh.

How to test:

  • start installing a game
  • stay in the library section until it ends
  • the library is not updated
  • change to different screens and go back, library still not updated
  • click the refresh button, not library is updated

With this change:

  • start installing a game
  • stay in the library section until it ends
  • a refresh is triggered in the background and the library is updated

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Feb 4, 2024
@arielj arielj requested review from a team, flavioislima, CommandMC, Etaash-mathamsetty, Nocccer and imLinguin and removed request for a team February 4, 2024 20:53
@arielj arielj added this to the 2.13.0 milestone Feb 4, 2024
@imLinguin
Copy link
Member

Maybe let's avoid refreshing the library after redistributables are downloaded. That could potentially create a race condition if the game were to download fast enough

@arielj
Copy link
Collaborator Author

arielj commented Feb 4, 2024

Maybe let's avoid refreshing the library after redistributables are downloaded. That could potentially create a race condition if the game were to download fast enough

can you elaborate? not sure what's the possible issue

is the backend sending 2 "done" game status updates during the installation of a gog game? if that's the case I'd rather make the backend send "done" after it finished installed everything once

Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@flavioislima
Copy link
Member

Maybe let's avoid refreshing the library after redistributables are downloaded. That could potentially create a race condition if the game were to download fast enough

I think it is fine because we only start the redistributable after the game install is completed.
Then we call wine on the prefix, if a new prefix (that is the default), it will be created and then will install the dependencies.
And then, if it refreshes again, it will be on the background, so should not cause any issues. I don't think any redist file will install THAT fast.

On windows will be no prefix, but I still think will be fine.

@imLinguin
Copy link
Member

Currently if the game has redistributables that need to be downloaded it's being handled before the game installation. That will cause the refresh, and if the game installation finishes during that refresh we get ourselves cool race condition.

@arielj
Copy link
Collaborator Author

arielj commented Feb 5, 2024

I'm still not sure I understand how the redistributables would trigger a refresh of the library

are you saying that the redistributables installation would trigger that handleGameStatus callback? if so, do you know what information we would have in the arguments? because I'm testing and I don't get 2 calls so I don't know what appName I would have to use to skip the refresh in that particular case

anyway, I'd rather not push a gameStatusUpdate massage to the frontend when the redistributables are installed if that's the case instead, I would handle that more like how we handle wine installation, not with game updates but with some other installation progress callbacks

@flavioislima
Copy link
Member

Currently if the game has redistributables that need to be downloaded it's being handled before the game installation. That will cause the refresh, and if the game installation finishes during that refresh we get ourselves cool race condition.

do you have examples that we could try?

@imLinguin
Copy link
Member

Okay, my bad it doesn't trigger this refresh. However

(14:01:34) DEBUG:   [Backend]:          {"free":159094288384,"diskSize":943968718848,"message":"148.17 GiB / 879.14 GiB","validPath":true,"validFlatpakPath":true}
(14:01:35) INFO:    [Backend]:          Writing config for 1893001152
(14:01:35) INFO:    [Gog]:              Got install info from cache for 1893001152 on windows platform
(14:01:35) INFO:    [DownloadManager]:  Mirror's Edge™  was added to the download queue.
(14:01:35) INFO:    [Backend]:          Preventing machine to sleep
(14:01:35) INFO:    [Gog]:              Got install info from cache for 1893001152 on windows platform
(14:01:35) INFO:    [Gog]:              Updating GOG redistributables
(14:01:35) INFO:    [Gog]:              GOG REDIST:: GOGDL_CONFIG_PATH=/home/linguin/.config/heroic/gogdlConfig /home/linguin/Projekty/Node/HeroicGamesLauncher/public/bin/linux/gogdl --auth-config-path /home/linguin/.config/heroic/gog_store/auth.json redist --ids ISI,MSVC2012_x64,DirectX,MSVC2010,MSVC2013_x64,MSVC2015_x64,MSVC2012,MSVC2013,MSVC2015,MSVC2005,PHYSX,PHYSXLEGACY --path /home/linguin/.config/heroic/tools/redist/gog
(14:01:35) DEBUG:   [Gog]:              Logging to file "/home/linguin/.config/heroic/GamesConfig/gog-redist.log"
(14:01:35) INFO:    [Gog]:              Got install info from cache for 1893001152 on windows platform
(14:01:38) INFO:    [Gog]:              Progress for Galaxy Common Redistributables: 5.26%/0.00MB/00:00:00 Down: 24.05MB/s / Disk: 2.6MB/s
(14:01:39) INFO:    [Gog]:              Progress for Galaxy Common Redistributables: 25.52%/30.65MB/00:00:05 Down: 23.1MB/s / Disk: 10MB/s
(14:01:40) INFO:    [Gog]:              Progress for Galaxy Common Redistributables: 100%/48.20MB/00:00:00 Down: 1.04MB/s / Disk: 36.76MB/s
(14:01:40) INFO:    [DownloadManager]:  gog-redist added to download manager finished.
(14:01:40) INFO:    [DownloadManager]:  gog-redist removed from download manager.
(14:01:40) INFO:    [Gog]:              Running command: GOGDL_CONFIG_PATH=/home/linguin/.config/heroic/gogdlConfig /home/linguin/Projekty/Node/HeroicGamesLauncher/public/bin/linux/gogdl --auth-config-path /home/linguin/.config/heroic/gog_store/auth.json auth
(14:01:40) INFO:    [Frontend]:         Refreshing gog Library
(14:01:40) INFO:    [Gog]:              Running command: GOGDL_CONFIG_PATH=/home/linguin/.config/heroic/gogdlConfig /home/linguin/Projekty/Node/HeroicGamesLauncher/public/bin/linux/gogdl --auth-config-path /home/linguin/.config/heroic/gog_store/auth.json auth
(14:01:40) INFO:    [Gog]:              Got install info from cache for 1893001152 on windows platform
(14:01:40) INFO:    [Gog]:              Got install info from cache for 1893001152 on windows platform
(14:01:40) ERROR:   [DownloadManager]:  Downloader: Failed to get headers for https://raw.githubusercontent.com/Heroic-Games-Launcher/known-fixes/main/gog/1893001152-gog.json. 
Error: Error: Request failed with status code 404
(node:17474) UnhandledPromiseRejectionWarning: Error: Failed to get headers
    at downloadFile$1 (/home/linguin/Projekty/Node/HeroicGamesLauncher/build/electron/main.25260cf5.js:24101:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
(node:17474) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(14:01:40) INFO:    [Gog]:              Installing 1893001152: GOGDL_CONFIG_PATH=/home/linguin/.config/heroic/gogdlConfig /home/linguin/Projekty/Node/HeroicGamesLauncher/public/bin/linux/gogdl --auth-config-path /home/linguin/.config/heroic/gog_store/auth.json download 1893001152 --platform windows --path /home/linguin/Games/Heroic --support /home/linguin/.config/heroic/gogdlConfig/heroic_gogdl/gog-support/1893001152 --skip-dlcs --lang pl-PL
(14:01:40) DEBUG:   [Gog]:              Logging to file "/home/linguin/.config/heroic/GamesConfig/1893001152.log"
(14:01:40) INFO:    [Gog]:              Getting GOG library
(14:01:40) INFO:    [Gog]:              Running command: GOGDL_CONFIG_PATH=/home/linguin/.config/heroic/gogdlConfig /home/linguin/Projekty/Node/HeroicGamesLauncher/public/bin/linux/gogdl --auth-config-path /home/linguin/.config/heroic/g

@arielj
Copy link
Collaborator Author

arielj commented Feb 6, 2024

I'm going to merge this one

I can also reproduce that other refresh but I can't really find where that's happening and it seems unrelated to this change

(would be nice to prevent that refresh but shouldn't be a blocker for this)

@arielj arielj merged commit c0263fa into main Feb 6, 2024
@arielj arielj deleted the reload-library-after-gog-install branch February 6, 2024 01:35
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants