node-sonos-http-api icon indicating copy to clipboard operation
node-sonos-http-api copied to clipboard

Restrict/allow concurrent '...all' actions

Open sgraystar opened this issue 5 years ago • 0 comments
trafficstars

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 }

sgraystar avatar Feb 01 '20 05:02 sgraystar