Skip to content

Commit

Permalink
Fix bug: duplicate log messages when polling
Browse files Browse the repository at this point in the history
  • Loading branch information
MediaMarco committed Jun 21, 2018
1 parent 9b26ebe commit 32adf30
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function getLog(logIndex) {
jobStatus.html("<span>UNKNOWN</span>");
},
success: function (data, textStatus, xhr) {
var newLogIndex = data.messages.length - 1;
var numberOfMessages = data.messages.length;
var logWindow = $('.logWindow');

while (logIndex <= newLogIndex) {
while (logIndex < numberOfMessages) {
if (logIndex === 0) {
logWindow.empty();
}
Expand All @@ -37,7 +37,7 @@ function getLog(logIndex) {
//Schedule further polling if still runnin'
if (data.state === 'Running') {
setTimeout(function () {
getLog(newLogIndex)
getLog(logIndex)
}, 2000);
} else {
var jobStatus = $('#job-status');
Expand Down

0 comments on commit 32adf30

Please sign in to comment.