sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.1k stars 70 forks source link

SteamGridDB: Add timeout and retries to SteamGridDB Artwork Fetching #958

Closed sonic2kk closed 10 months ago

sonic2kk commented 10 months ago

Another bit for #933.

This adds a timeout for SteamGridDB, and a specific amount of retries. The default timeout is 15 seconds, and the maximum number of retries is set to 5.

The reason for this is wget will retry for 600 seconds by default. It will also infinitely retry. In testing I found there are intermittent failures when fetching artwork from SteamGridDB, where it will just hang (possibly related to my internet connection?).

A good use-case for this is when adding Non-Steam Games, even though you can Ctrl+C, this will end up corrupting the shortcuts.vdf and you will lose all your shortcuts. To prevent that case, and to hopefully retry and successfully download artwork, this change will allow for a timeout and retry. If wget fails after those 5 attempts it will move onto the next piece of artwork to download, or if it was the last artwork that it failed on, then it will just return and add the Steam shortcut as normal.

If artwork fails, this PR will be especially useful once we can get AppIDs for Non-Steam Games. The user can see the artwork failed to download and they can retry on the AppID.


Shellcheck is green on this, but I want to do a little more testing before merging, probably tomorrow at this point.

TODO:

sonic2kk commented 10 months ago

Tested and this works with ansg and sgdb commands, so this should be good to merge. Shellcheck is green and version is bumped!

sonic2kk commented 10 months ago

We should consider implementing a timeout and retry elsewhere in the codebase as well, but that could go in a future PR (even better from a community member -- it would be a good way to start contributing!)