From 9787deb38e31fd6421a70a536eac8458786d419a Mon Sep 17 00:00:00 2001 From: Annika Backstrom Date: Sun, 9 Apr 2017 22:50:06 -0400 Subject: [PATCH] Disable trailing execution of throttled commands We don't want to run the function at the end of the throttling period. This causes the track to start, then re-start after the timeout ends. --- jukebox/media-player.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jukebox/media-player.js b/jukebox/media-player.js index ce7f28e..e35e012 100644 --- a/jukebox/media-player.js +++ b/jukebox/media-player.js @@ -19,9 +19,9 @@ class MediaPlayer extends ChildProcessEmitter { return line.substr(0, 3) == '@F ' }); - this.stopThrottled = throttle(config.stop_throttle || DEFAULT_STOP_THROTTLE, this._stop); - this.pauseThrottled = throttle(config.pause_throttle || DEFAULT_PAUSE_THROTTLE, this._pause); - this.playFileThrottled = throttle(config.play_throttle || DEFAULT_PLAY_THROTTLE, this._playFile); + this.stopThrottled = throttle(config.stop_throttle || DEFAULT_STOP_THROTTLE, true, this._stop); + this.pauseThrottled = throttle(config.pause_throttle || DEFAULT_PAUSE_THROTTLE, true, this._pause); + this.playFileThrottled = throttle(config.play_throttle || DEFAULT_PLAY_THROTTLE, true, this._playFile); // always throttled this.unknown = throttle(config.unknown_throttle || DEFAULT_UNKNOWN_THROTTLE, this._unknown);