-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add session timeout handling #1129
Conversation
Thanks for this. As mentioned on Gitter I'll be happy to remain here for assistance and code reviews, but no longer have a Premium account myself so that's that. Overall question of design: there's a common Tokio pattern of having a As a downside, that would require downstream applications to implement such a watchdog themselves... |
Thank you for doing this and keeping the project alive!
When implementing this, I wasn't sure either where to put this. Having something like |
Thanks that latest change does make things much simpler! Any remaining points / questions apart from that single review comment I left? Looks good to me otherwise. |
Did you get around to fixing the CI / dependency issue? Is it necessary to up MSRV? |
Oh, when I last pushed to this PR I saw the first few checks succeeding and assumed everything was fine. Apparently, the So I'm not entirely sure what to do: Should I bump the MSRV to Footnotes
|
I see, thanks. Unless someone disagrees, I feel like merging this PR as-is then and accepting a broken Windows CI for the time being. |
Sorry for being late to the party. Having this tied to the |
That's a good point. Pity of the current implementation, because it is much easier than the earlier one with all the threading going one. Any thoughts for an intermediate solution -- one that's not within |
Hmm. With the current solution, the project you mentioned could implement that timeout handling themselves by simply keeping the session object and calling The general problem here is:
What do you think? |
Indeed #1 will require major refactoring. It's necessary anyway if we ever want to get the I'm not a fan of #3 because most downstream packages actually have implemented their own player logic. So that leaves #2 or "#0" with the implementation instruction to call Happy to hear any other thoughts. |
Indeed, not everyone uses
I agree. I originally didn't like the application having to call On the subject of option 2, I had a go at a variant but I was wrestling with the Error types and couldn't even get it to compile so I gave up - sorry! Anyway, if it is interesting, it's at df29bee. Using |
Assuming this is the route we want to take for now, I added some docs to |
Oh, thank you for sharing. This also sounds like an interesting idea, especially just calling an async function instead of writing an entire struct for that. That might work as well. If you're generally in favor of this, I can certainly try making that work. |
@eladyn would you be willing to revise the code for those ergonomics, so we can merge? |
I'll see if I can find the time this weekend. I assume you mean the proposal of @kingosticks in the direction of adding additional error variants? |
Sorry for taking so long. I finally found the time to try @kingosticks' proposal for handling the session timeout and just pushed the changes. It certainly feels like it might be easier to add the reconnection logic later on in this version. Happy to take your feedback. (Note: I removed the error variant from the session error struct that you added, since the |
Thanks for coming back to it @eladyn. I think it's neat and gets my vote. |
Indeed, thank you, looks very neat. If you would also add a changelog entry, then we can merge. |
Oh, now clippy found something new to complain about. Should I fix this here? |
Yes if you would? So we can keep CI nice and clean. Thanks. |
That is awesome, thanks both. |
Hey, thanks a lot for this improvement. Is there a release planned anytime soon? I believe downstream applications (e.g. ncspot) would really benefit from this (plus all the other goodies in |
any release date? |
This project doesn't have planned release dates, so no. The other work required to release the main branch has not been completed and I don't think anyone is actively working on it. This is an issue that needs addressing. |
See #1102 (comment).
This makes sure that we receive a
ping
at least every 2 minutes (which seems to happen consistently, when connected) and otherwise shuts down the session, since the connection stalled in this case. (inspired by thelibrespot-java
implementation)In combination with the changes to
main.rs
, this makes sure that librespot successfully reconnects.I tested this by suspending my laptop and waking it up several hours later. After less than 2 minutes, it noticed that the connection had stalled and restarted itself.
(Hopefully) Fixes #1102.