Prevent server from infinite looping when google docs refresh fails

This commit is contained in:
Calvin Montgomery 2014-05-24 11:06:46 -07:00
parent f3eb999a76
commit 3cae0b0e57
1 changed files with 6 additions and 2 deletions

View File

@ -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 {