librespot-org / librespot

Open Source Spotify client library
MIT License
4.52k stars 544 forks source link

Discovery retry #1178

Closed JasonLG1979 closed 1 year ago

JasonLG1979 commented 1 year ago

When started at boot as a service discovery may fail due to it trying to bind to interfaces before the network is actually up. This could be prevented in systemd by starting the service after network-online.target but it requires that a wait-online.service is also enabled which is not always the case since a wait-online.service can potentially hang the boot process until it times out in certain situations. This allows for discovery to retry every 10 secs in the 1st 60 secs of uptime before giving up thus papering over the issue and not holding up the boot process.

JasonLG1979 commented 1 year ago

This is another of those fixes that's been in Raspotify for months. It's helps to prevent librespot from spaming the logs at boot when it's used as a service.

roderickvd commented 1 year ago

The functionality seems good to me, however I recommend that you use the sysinfo crate to get the current uptime. We're already using that crate, so can avoid adding another one (or, if it depends on uptime itself, have a common facade).

JasonLG1979 commented 1 year ago

The functionality seems good to me, however I recommend that you use the sysinfo crate to get the current uptime. We're already using that crate, so can avoid adding another one (or, if it depends on uptime itself, have a common facade).

Are we using sysinfo in main at all? Is there a point to pulling in sysinfo just for uptime when uptime is a super, super tiny crate comapred to sysinfo when all we'd be using is the uptime functionality?

roderickvd commented 1 year ago

Don't know about main but it's used in librespot-core, so no main without it.

JasonLG1979 commented 1 year ago

Ok if I can pull it in in main for free it makes since to use it then.

roderickvd commented 1 year ago

OK let me know when you have and please also add a changelog entry so we can merge.

JasonLG1979 commented 1 year ago

OK let me know when you have and please also add a changelog entry so we can merge.

Done.