Prevent subsequent sync attempts until getTimePosition returns. (#238)
Fixes #237.
This commit is contained in:
parent
b122785e31
commit
4879c3e3ce
@ -105,6 +105,13 @@ Project resources
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
(UNRELEASED)
|
||||||
|
------------
|
||||||
|
|
||||||
|
**Fixes**
|
||||||
|
|
||||||
|
- Prevent excessive calls to the Mopidy server while buffering. (Fixes: `#237 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/237>`_).
|
||||||
|
|
||||||
v2.4.0 (2017-03-15)
|
v2.4.0 (2017-03-15)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,9 @@
|
|||||||
// check in the timeout callback than doing another function call.
|
// check in the timeout callback than doing another function call.
|
||||||
clearTimeout(this._scheduleID)
|
clearTimeout(this._scheduleID)
|
||||||
this._isSyncScheduled = false
|
this._isSyncScheduled = false
|
||||||
this._scheduleID = setTimeout($.proxy(function () { this._isSyncScheduled = true }, this), milliseconds)
|
if (milliseconds >= 0) {
|
||||||
|
this._scheduleID = setTimeout($.proxy(function () { this._isSyncScheduled = true }, this), milliseconds)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncedProgressTimer.prototype._doSync = function (position, duration) {
|
SyncedProgressTimer.prototype._doSync = function (position, duration) {
|
||||||
@ -116,6 +118,8 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._scheduleSync(-1) // Ensure that only one sync process is active at a time.
|
||||||
|
|
||||||
var _this = this
|
var _this = this
|
||||||
_this._mopidy.playback.getTimePosition().then(function (targetPosition) {
|
_this._mopidy.playback.getTimePosition().then(function (targetPosition) {
|
||||||
if (_this.syncState === SyncedProgressTimer.SYNC_STATE.NOT_SYNCED) {
|
if (_this.syncState === SyncedProgressTimer.SYNC_STATE.NOT_SYNCED) {
|
||||||
@ -179,8 +183,7 @@
|
|||||||
|
|
||||||
SyncedProgressTimer.prototype.stop = function () {
|
SyncedProgressTimer.prototype.stop = function () {
|
||||||
this._progressTimer.stop()
|
this._progressTimer.stop()
|
||||||
clearTimeout(this._scheduleID)
|
this._scheduleSync(-1)
|
||||||
this._isSyncScheduled = false
|
|
||||||
if (this.syncState !== SyncedProgressTimer.SYNC_STATE.SYNCED && this._previousSyncPosition) {
|
if (this.syncState !== SyncedProgressTimer.SYNC_STATE.SYNCED && this._previousSyncPosition) {
|
||||||
// Timer was busy trying to sync when it was stopped, fallback to displaying the last synced position on screen.
|
// Timer was busy trying to sync when it was stopped, fallback to displaying the last synced position on screen.
|
||||||
this.positionNode.nodeValue = SyncedProgressTimer.format(this._previousSyncPosition)
|
this.positionNode.nodeValue = SyncedProgressTimer.format(this._previousSyncPosition)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
|
|
||||||
# 2017-02-26:v1
|
# 2017-04-14:v1
|
||||||
|
|
||||||
NETWORK:
|
NETWORK:
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user