Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Race condition: lyrics and extra song info appear on other songs when fast skipping #5

Closed
NyaomiDEV opened this issue Jan 17, 2022 · 1 comment

Comments

@NyaomiDEV
Copy link
Owner

NyaomiDEV commented Jan 17, 2022

Currently, for each update that Sunamu gets, a callback function updateInfo is called with the current update as its argument. This function runs asynchronously and it does a chain of asynchronous stuff:

  • update the shown information once, right after the update was pushed (first point of suspension)
  • gather more information about the track being played (lyrics.. etc) (second point of suspension)
  • update the shown information again, to push all the remaining information to the renderer process(es) (third point of suspension)

Now, if updates were sparse in time, this would've been a non-issue since there'd be plenty of time for the neat completion of any and all of those function calls; however, if a person skips really fast or if they have a bad Internet connection that delays the information gathering, then we are presented with race conditions.

We must avoid those race conditions, and mark as "out of date" all the updateInfo calls running, except the very last one

@NyaomiDEV
Copy link
Owner Author

Probably fixed by 700a263

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant