Fix IdleShutdown timer #2536#2592
Open
jdeitmerg wants to merge 7 commits intoMiczFlor:future3/developfrom
Open
Fix IdleShutdown timer #2536#2592jdeitmerg wants to merge 7 commits intoMiczFlor:future3/developfrom
jdeitmerg wants to merge 7 commits intoMiczFlor:future3/developfrom
Conversation
Pull Request Test Coverage Report for Build 20992221818Details
💛 - Coveralls |
Change to fully synchronous approach rather than mixing synchronous and asynchronous behavior - simplifies logic - fixes order of activity (e.g. playback first, then SSH vs. SSH first, then playback) influencing behavior - replaces some custom code with builtin Python functions Modifies RPC API of timer_idle_shutdown, potentially breaking compatibility.
3162813 to
e745877
Compare
Author
|
I'm done with refactoring Notes:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I ran headfirst into #2536 and spent some time untangling it.
Context
#1970 Feature issue
#2536 Bug issue
#2535 Workaround for #2536, superseded by this PR
Fixes
With this PR, the shutdown timer works as documented for most cases. For why each change was necessary, refer to the commit messages.
Caveat: New bug
If not audio is playing for >
timeout_sec, but there's SSH or file activity, the shut down will be delayed (as expected). However, the system will shut down once there's no more SSH or file activity, even if audio is playing. This is particularly nasty for the kid who wants to listen to the new cards that were just added via the full-sync feature.Moving on
I ran into a lot of concurrency footguns in this module. E.g. the timer trying to change it's own timeout. Which cancels the timer before it can restart itself.
To fix the new bug above, I'd like to refactor the whole shutdown timer in the following fashion:
timeout_secSo no more shutdown timer object which implicitly tracks global state and is modified in asynchronous, hard to debug ways. Instead, simple state tracking and acting on it synchronously.
Can someone provide feedback on that approach before I dive in?