mopidy / mopidy-scrobbler

Mopidy extension for scrobbling played tracks to Last.fm
https://mopidy.com/ext/scrobbler/
Apache License 2.0
66 stars 14 forks source link

Retry connection to Last.fm if no network #3

Open deadcyclo opened 10 years ago

deadcyclo commented 10 years ago

mopidy-scrobbler doesn't work when using mopidy from the repository. The reason is that the init script starts mopidy before network interfaces are properly available, and scrobbler fails when trying to connect to last.fm. The initial knee-jerk solution would be to change init scripts to wait for network connectivity, but that's not right since mopidy can be used for local content completely without a network connection.

I quickly hacked a fix locally by adding a 5 second delay to the scrobbler start method, but a proper fix would be to catch network exceptions separately from other exceptions and have have network exceptions enter a retry loop that retries every x seconds. I don't have time to create a patch right now, but I might have a chance in a few weeks (if nobody else grabs this first).

jodal commented 10 years ago

Thanks for the report. Having the extension retry with an increasing waiting time before the next retry until it gets network sounds like the proper solution.

DmitrySandalov commented 9 years ago

The scrobbler works for me! Installed on a fresh system from debian/ubuntu repo: mopidy 0.19.4-1, mopidy-scrobbler 1.1.0-1. I think the bug is not relevant anymore. @deadcyclo, does it still affect you?

jodal commented 9 years ago

Up to and including Debian package 0.19.4-2 the init script has waited for "$network", which simply means basic ethernet working, and not necessarily Internet being available. In the next Debian package update, it'll also wait for the LSB facility "$named", which means that Mopidy should wait with startup until DNS lookups are possible. Ref mopidy/mopidy@a594f6590c5bcd5ec097bcd494c140cab149cfa5.

I hope this change will help on this issue.