From 3cae0b0e5742fa4f6beb4578a688c5e5461f45aa Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sat, 24 May 2014 11:06:46 -0700 Subject: [PATCH] Prevent server from infinite looping when google docs refresh fails --- lib/channel/playlist.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/channel/playlist.js b/lib/channel/playlist.js index c9d43fd6..97fa5e22 100644 --- a/lib/channel/playlist.js +++ b/lib/channel/playlist.js @@ -940,7 +940,7 @@ PlaylistModule.prototype.startPlayback = function (time) { return; } - if (media.type === "gd" && !media.meta.object) { + if (media.type === "gd" && !media.meta.object && !media.meta.failed) { self.channel.activeLock.lock(); this.refreshGoogleDocs(function () { self.channel.activeLock.release(); @@ -1039,6 +1039,7 @@ PlaylistModule.prototype.refreshGoogleDocs = function (cb) { self._gdRefreshTimer = false; if (self.current) { self.current.media.meta.object = self.current.media.meta.object || null; + self.current.media.meta.failed = true; } if (cb) { cb(); @@ -1054,7 +1055,10 @@ PlaylistModule.prototype.refreshGoogleDocs = function (cb) { if (err) { Logger.errlog.log("Google Docs autorefresh failed: " + err); Logger.errlog.log("ID was: " + self.current.media.id); - self.current.media.meta.object = self.current.media.meta.object || null; + if (self.current) { + self.current.media.meta.object = self.current.media.meta.object || null; + self.current.media.meta.failed = true; + } cb && cb(); self.channel.activeLock.release(); } else {