Repository navigation
fix(playback): keep the track-end poll when a command lands early in the track - #725
Conversation
…the track The poll after a Web API command moved the last-poll time back and marked the track-end poll as spent. Volume, shuffle and repeat leave Spotify's timestamp alone, so a command early in a track cancelled that track's end poll. The command poll now has its own deadline. It also survives a poll that is already in flight. The 429 log line is built outside the macro so the tests run it, and episodes and unknown items get a test.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (6)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe app now stores a separate deadline for playback polling after a Web API command. Poll dispatch checks that deadline without replacing regular or track-end polling. Tests cover command-poll timing and related polling cases. The 429 warning path formats its message before logging. ChangesCommand-triggered Playback Polling
429 Warning Formatting
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk is identified; the change is ready for normal merge checks. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks for the quick follow-up, @Wassergeist! This is the cleaner of the two fixes, and I checked it locally: a volume change 60 s before the end no longer uses up the track-end poll (the same test fails on Two small, non-blocking ideas:
Totally fine to leave both for later. |
|
@2570165831 Thanks for checking it locally! Since it's merged already, I'll keep both in mind for the next time I'm in that code. |
Summary
Follow-up to #721, from @2570165831's review there.
poll_playback_soonmoved the last-poll time back and always spent the track-end poll. Volume, shuffle and repeat don't change Spotify'stimestamp, so a command early in a track used up that track's end poll and the next track showed up toplayback_poll_secondslate.The poll after a command now has its own deadline (
command_poll_at) instead of moving the last-poll time, so the regular and the track-end poll keep their timing and nothing gets spent. The track-end poll is only spent when it actually fired.This also fixes the thing I mentioned in #721: a poll already queued when the command lands no longer swallows the poll a second later, the deadline survives it.
Smaller things while at it:
warn!so the tests run itUnknownitem (ads), using theepisode()fixture frommedia_metadata(its test module ispub(crate)now, like the one innetwork/metadata.rs)Testing
a_command_early_in_the_track_keeps_its_end_pollkeeps the sametimestampfor the follow-up poll, as suggested, and fails with the oldspend_track_end_poll()inpoll_playback_soon.Also tested with a release build (
--debug):Summary by CodeRabbit