ModAssistant icon indicating copy to clipboard operation
ModAssistant copied to clipboard

Race condition when checking for versions

Open Emosewaj opened this issue 3 years ago • 0 comments

When clicking the I Agree button after launching ModAssistant, I would always immediately get the error Could not download versions list. After doing regular troubleshooting with no success I've decided to dig into the code.

I was able to figure out that, at least on my end, the download of the resources at https://versions.beatmods.com/versions.json and at https://alias.beatmods.com/aliases.json both take exactly 42.5~ seconds each, meaning the game version check only happens after about a minute and a half, only after that does the I Agree button function properly, meaning checking for a checked version in the Main Window can potentially happen way before the version check has finished.

devenv_2022-09-07_00-25-36 devenv_2022-09-07_00-26-40

System.Diagnostics.Stopwatch was used to generate these timings. Note that both resources load instantaneously on my regular web browser. Only Mod Assistant is slow in acquiring them.

I would personally suggest that the check that causes the Could not download versions list error be decoupled from the I Agree button as the Mods tab button enables itself automatically once the version check has passed. The error popup may instead be tied to an actual failure during the download and/or check process. You could display a modal indicating that the version check is still in progress, perhaps like so: ModAssistant_2022-09-07_00-40-30 If the version check is still in progress after clicking I Agree, you could replace the text on the Intro tab with a hint that version check is still in progress, and to please wait.

Emosewaj avatar Sep 06 '22 22:09 Emosewaj