Lautaro-Garcia / counsel-spotify

Control Spotify App through Emacs
GNU General Public License v3.0
59 stars 8 forks source link

Search hangs and fails out when entering input too fast #7

Closed eastwood closed 4 years ago

eastwood commented 4 years ago

I've noticed that the ivy-interface for searching is very slow and hangs quite a bit when entering input. It feels like a synchronous call to spotify on each character. There also seems to be a bit of a race condition when you enter a string too fast either:

  1. Characters are missing
  2. The window crashes

I can provide a screen recording on request.

I'm happy to look into fixing this, but wanted to validate whether this is confirmed behaviour first

Lautaro-Garcia commented 4 years ago

Hey! Well, you are correct, it calls the Spotify API synchronously on each character. I didn't know how to make asynchronous calls with Emacs when I first made this package, and never revisited it either. If you want to write some elisp I would gladly help you with everything you need, it's a thing that I had in mind but never got around to actually code it :sweat_smile:

Lautaro-Garcia commented 4 years ago

I had some time this weekend and could address this issue. There was an Ivy new version that brought the feature of asynchronous candidate lists, so I change all the calls to Spotify to be non-blocking and used this new feature to fill up the possible tracks/albums/artists. From this commit on, the Spotify completion should feel snappier, so let me know if that solved the problem for you!