From 81520084663fe0d4cabc3cb02992176dcdabd939 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sun, 15 Jun 2014 16:34:32 -0700 Subject: [PATCH] Crash fix --- lib/channel/playlist.js | 10 +++++++++- lib/get-info.js | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/channel/playlist.js b/lib/channel/playlist.js index a007e3da..e1bf11f9 100644 --- a/lib/channel/playlist.js +++ b/lib/channel/playlist.js @@ -1039,6 +1039,7 @@ PlaylistModule.prototype.startPlayback = function (time) { if (media.type === "gd") { this._gdRefreshTimer = setInterval(this.refreshGoogleDocs.bind(this), 3600000); if (media.meta.expiration && media.meta.expiration < Date.now() + 3600000) { + var self = this; setTimeout(this.refreshGoogleDocs.bind(this), media.meta.expiration - Date.now()); } } @@ -1086,6 +1087,11 @@ PlaylistModule.prototype._leadLoop = function() { PlaylistModule.prototype.refreshGoogleDocs = function (cb) { var self = this; + + if (self.dead || !self.channel || self.channel.dead) { + return; + } + var abort = function () { clearInterval(self._gdRefreshTimer); self._gdRefreshTimer = false; @@ -1111,7 +1117,9 @@ PlaylistModule.prototype.refreshGoogleDocs = function (cb) { self.current.media.meta.object = self.current.media.meta.object || null; self.current.media.meta.failed = true; } - cb && cb(); + if (cb) { + cb(); + } self.channel.activeLock.release(); } else { if (!self.current || self.current.media.type !== "gd") { diff --git a/lib/get-info.js b/lib/get-info.js index 282c3667..1e8d6339 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -27,7 +27,6 @@ var urlRetrieve = function (transport, options, callback) { Logger.errlog.log(err.stack); Logger.errlog.log("urlRetrieve failed: " + err); Logger.errlog.log("Request was: " + options.host + options.path); - callback(503, err); }); d.run(function () { var req = transport.request(options, function (res) {