Skip to content

Commit

Permalink
SUP-8601
Browse files Browse the repository at this point in the history
  • Loading branch information
kalturaguy committed Jun 28, 2016
1 parent 2bd6aaa commit 7f12297
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
44 changes: 22 additions & 22 deletions lib/entry/FlavorDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,33 +228,33 @@ var FlavorDownloader = (function() {
.then(function(m3u) {
return updateListOfNewChunksToProcess(m3u);
})
.then(function(newChunks) {
.then(function (newChunks) {

var deferred = Q.defer();

downloadChunks.call(that, baseUrl, _.keys(that.chunksToDownload))
.finally(function() {
that.m3u8generator.update(newChunks)
.then(function(results) {
var newItemsCount= results.newItemsCount;
if (newItemsCount > 0) {
that.emit('newTsFiles', that, newItemsCount);
}
return results;
})
.then(function(results) {
processObsoleteChunks(results); // Trigger deletion on a best-effort basis
return results;
})
.then(function(result){
deferred.resolve(result);
})
.catch(function(err){
deferred.reject(err);
})
.finally(function () {
that.m3u8generator.update(newChunks)
.then(function (results) {
var newItemsCount = results.newItemsCount;
if (newItemsCount > 0) {
that.emit('newTsFiles', that, newItemsCount);
}
return results;
})
.then(function (results) {
processObsoleteChunks(results); // Trigger deletion on a best-effort basis
return results;
})
.then(function (result) {
deferred.resolve(result);
})
.catch(function (err) {
deferred.reject(err);
})
});
return deferred.promise;
});
return deferred.promise;
});
}, function(err) {
if (err == httpUtils.HttpDownloadNotChanged) {
return Q.resolve();
Expand Down
6 changes: 3 additions & 3 deletions lib/manifest/PlaylistGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function PlaylistGenerator(entryObject, isNewSession) {
this.streamInfo = entryObject.getStreamInfo();
this.flavorsObjArray = null;
this.logger = loggerModule.getLogger("PlaylistGenerator", "[" + this.entryId + "] ");
this.entryServerNodeId = entryObject.entryServerNodeId ? entryObject.entryServerNodeId : null;
this.entryServerNodeId = null;
this.entryServerType = parseInt(entryObject.serverType);
}

Expand Down Expand Up @@ -92,7 +92,7 @@ function savePlaylist() {
that.entryServerNodeId ? Q.Promise.resolve(that.entryServerNodeId)
: backendClient.getLiveEntryServerNodes(that.entryId).then(function(liveEntryServerNodes) {

that.entryServerNodeId = 0;
that.entryServerNodeId = null;
_.each(liveEntryServerNodes, function(liveEntryServerNode) {
if (liveEntryServerNode.serverType === that.entryServerType) {
that.entryServerNodeId = liveEntryServerNode.id;
Expand All @@ -101,7 +101,7 @@ function savePlaylist() {
});

}).catch(function() {
that.entryServerNodeId = 0;
that.entryServerNodeId = null;
return null;
});

Expand Down

0 comments on commit 7f12297

Please sign in to comment.