Restrict/allow concurrent '...all' actions #743
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.
Concurrent clipall/sayall can leave the system in an undefined state if the second action is processed while the system is in a partially grouped state. An example is clipall/sayall being used with a doorbell and someone pressing the doorbell button twice.
This feature implements a check within all-player-announcements. Calls to the helper will start a timer and, if restricted, subsequent calls will be ignored while the timer is active.
This allows time for the original state to be restored before the next clipall/sayall action.
Global variables are possibly not the best implementation, but none of the existing helper files require settings.js so this change did not introduce a require settings.js to all-player-announcements.
The auto changes look larger than actual changes to all-player-announcements, in summary:
if NOT (restricted AND current active announcement) {
start timer and use timer handle to track an active announcement
existing code
}
function (timer expiry) {
null the timer handle
}