tkem / mopidy-mobile

Mopidy Web client extension and hybrid app for mobile devices
Apache License 2.0
78 stars 14 forks source link

Add request timeouts #126

Closed tkem closed 8 years ago

tkem commented 9 years ago
tkem commented 9 years ago

Since there's no way to "cancel" a Mopidy request, simply removing the timeout would also be an option. Care should be taken that reconnects disable the spinner, since it's unclear whether the request made it through in this case.

ZenithDK commented 8 years ago

I've started to use the Tidal backend, and when I do searches Mopidy-Mobile gets stuck doing look-ups when I search for "Sande" for instance. I search for "Sande" - get a list of hits, and then it just does requests over and over, even if I choose one of the artists. I think it should stop (abort the look-ups) and try to load the information I asked for.

Example

DEBUG    2016-03-04 17:41:57,214 [6733:HttpServer] mopidy.http.handlers
  Received WebSocket message from 10.0.0.102: u'{"method":"core.library.search","params":{"query":{"any":["Sande"]},"uris":["tidal
:my_albums"],"exact":false},"jsonrpc":"2.0","id":20}'
INFO     2016-03-04 17:41:57,218 [6733:TidalBackend-8] mopidy_tidal.lru_cache
  Search cache miss
INFO     2016-03-04 17:41:57,219 [6733:TidalBackend-8] mopidy_tidal.search
  Searching Tidal for:  {u'any': [u'Sande']}
DEBUG    2016-03-04 17:41:58,433 [6733:HttpServer] mopidy.http.handlers
  Received WebSocket message from 10.0.0.102: u'{"method":"core.library.get_images","params":{"uris":["tidal:artist:6305009","tida
l:artist:21985","tidal:artist:7374548","tidal:artist:4093991","tidal:artist:5886700","tidal:artist:7265939","tidal:artist:7042688"
,"tidal:artist:6174331","tidal:artist:4573831","tidal:artist:5293966","tidal:artist:3543813","tidal:artist:6978833","tidal:artist:
5754599","tidal:artist:6539355","tidal:artist:3664695","tidal:artist:5595221","tidal:artist:5415362","tidal:artist:4657054","tidal
:artist:3524909","tidal:artist:5528111","tidal:artist:5543937","tidal:artist:3612074","tidal:artist:5526493","tidal:artist:5877608
","tidal:artist:4887587","tidal:artist:4101809","tidal:artist:3529018","tidal:artist:5612021","tidal:artist:21376","tidal:artist:1
6526","tidal:artist:5612022","tidal:artist:3505698","tidal:artist:5612025","tidal:artist:31823","tidal:artist:21466","tidal:artist:3659104","tidal:artist:22617","tidal:artist:4913676","tidal:artist:5949358","tidal:artist:6752743","tidal:artist:3843217","tidal:artist:4583129","tidal:artist:20470","tidal:artist:6311902","tidal:artist:3915789","tidal:artist:3559007","tidal:artist:5338300","tidal:artist:6760223","tidal:artist:3569046","tidal:artist:5427015","tidal:album:18114165","tidal:album:18854255","tidal:album:23412566","tidal:album:55230230","tidal:album:7844966","tidal:album:2798308","tidal:album:46717897","tidal:album:8521194","tidal:album:51253473","tidal:album:10720203","tidal:album:40282262","tidal:album:34923070","tidal:album:412167","tidal:album:1089479","tidal:album:35637425","tidal:album:25827772","tidal:album:1726451","tidal:album:23393786","tidal:album:52704052","tidal:album:51349898","tidal:album:30297912","tidal:album:16822101","tidal:album:4129836","tidal:album:20632547","tidal:album:15359575","tidal:album:17243430","tidal:album:1387892","tidal:album:24886844","tidal:album:3136051","tidal:album:20078453","tidal:album:47317666","tidal:album:3629557","tidal:album:24886964","tidal:album:33206294","tidal:album:33206694","tidal:album:51982359","tidal:album:432298","tidal:album:48469186","tidal:album:14824412","tidal:album:451671","tidal:album:425414","tidal:album:15199703","tidal:album:48582758","tidal:album:441809","tidal:album:3561250","tidal:album:4591864","tidal:album:16455590","tidal:album:12596163","tidal:album:29141580","tidal:album:52032337","tidal:track:4093991:18114165:18114179","tidal:track:3980751:14061678:14061772","tidal:track:27343:54059864:54059866","tidal:track:27779:37078083:37078084","tidal:track:5701795:49946009:49946019","tidal:track:27779:52591971:52591975","tidal:track:4093991:18114165:18114175","tidal:track:3816041:20556792:20556809","tidal:track:27779:37664495:37664499","tidal:track:27343:37870588:37870590","tidal:track:4506674:19842761:19842773","tidal:track:4093991:18114165:18114170","tidal:track:4093991::18114165:18114167","tidal:track:4093991:7844966:7844967","tidal:track:4101809:53926721:53926722","tidal:track:4093991:18854255:18854269","tidal:track:4093991:18114165:18114174","tidal:track:4842169:19015510:19015513","tidal:track:4093991:19993832:19993834","tidal:track:25218:8521194:8521195","tidal:track:4093991:18114165:18114173","tidal:track:27343:54059864:54059891","tidal:track:4101809:55230230:55230231","tidal:track:4093991:10720203:10720204","tidal:track:4093991:23412566:23412580","tidal:track:3529018:53036734:53036736","tidal:track:4091:491119:491122","tidal:track:3980751:17936717:17936718","tidal:track:4842169:33651630:33651632","tidal:track:4093991:18854255:18854265","tidal:track:3524909:2798308:2798310","tidal:track:4093991:18114165:18114166","tidal:track:4101809:55230230:55230232","tidal:track:4093991:18114165:18114184","tidal:track:3519594:18114165:18114180","tidal:track:27343:54059864:54059890","tidal:track:4101809:55230230:55230233","tidal:track:27779:41604574:41604580","tidal:track:4101809:55230230:55230234","tidal:track:4093991:18114165:18114168","tidal:track:5488258:47297047:47297063","tidal:track:3851676:23498325:23498326","tidal:track:4093991:18114165:18114171","tidal:track:4101809:51089356:51089357","tidal:track:3816041:20556777:20556791","tidal:track:3588010:42619692:42619710","tidal:track:4093991:18114165:18114176","tidal:track:4101809:55230230:55230235","tidal:track:27343:40282262:40282263","tidal:track:3524909:2798308:2798320"]},"jsonrpc":"2.0","id":21}'
INFO     2016-03-04 17:41:58,465 [6733:TidalBackend-8] mopidy_tidal.library
  Lookup uris u'tidal:artist:6305009'
INFO     2016-03-04 17:41:59,010 [6733:TidalBackend-8] mopidy_tidal.library
  Returning 4 tracks
...
...
...
INFO     2016-03-04 17:42:09,983 [6733:TidalBackend-8] mopidy_tidal.library
  Returning 2 tracks
INFO     2016-03-04 17:42:09,984 [6733:TidalBackend-8] mopidy_tidal.library
  Lookup uris u'tidal:artist:5543937'
INFO     2016-03-04 17:42:10,524 [6733:TidalBackend-8] mopidy_tidal.library
  Returning 1 tracks
INFO     2016-03-04 17:42:10,525 [6733:TidalBackend-8] mopidy_tidal.library
  Lookup uris u'tidal:artist:3612074'
INFO     2016-03-04 17:42:11,194 [6733:TidalBackend-8] mopidy_tidal.library
  Returning 123 tracks
INFO     2016-03-04 17:42:11,198 [6733:TidalBackend-8] mopidy_tidal.library
  Lookup uris u'tidal:artist:5526493'
INFO     2016-03-04 17:42:11,784 [6733:TidalBackend-8] mopidy_tidal.library
  Returning 1 tracks
INFO     2016-03-04 17:42:11,785 [6733:TidalBackend-8] mopidy_tidal.library
  Lookup uris u'tidal:artist:5877608'
INFO     2016-03-04 17:42:12,328 [6733:TidalBackend-8] mopidy_tidal.library
  Returning 1 tracks
...

And so on - it eventually completes and looks up the artist I pressed, though.

tkem commented 8 years ago

@ZenithDK: AFAICS Mopidy Mobile sends a single get_images () request to the server, so there's nothing it can do to "stop" these. However, I guess this warrants a separate issue, since it is not related to "timeouts" in any manner. Update: To be continued in #183. In the mean time, please try disabling Mopidy Cover Art (Settings -> Cover art).

tkem commented 8 years ago

Although "Wait or Cancel" would be nice, for a first go at this it turned out to be simpler to just handle timeouts as errors.