mopidy / mopidy-scrobbler

Mopidy extension for scrobbling played tracks to Last.fm

Home Page:https://mopidy.com/ext/scrobbler/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Retry connection to Last.fm if no network

deadcyclo opened this issue · comments

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).

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.

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?

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@a594f65.

I hope this change will help on this issue.