From 32adf3054b6b248864d74a05c2ab07e787955f4c Mon Sep 17 00:00:00 2001 From: Marco Geweke Date: Thu, 21 Jun 2018 13:49:11 +0200 Subject: [PATCH] Fix bug: duplicate log messages when polling --- .../src/main/resources/static/internal/js/logLoader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/edison-jobs/src/main/resources/static/internal/js/logLoader.js b/edison-jobs/src/main/resources/static/internal/js/logLoader.js index c694c3e96..7cb94a847 100644 --- a/edison-jobs/src/main/resources/static/internal/js/logLoader.js +++ b/edison-jobs/src/main/resources/static/internal/js/logLoader.js @@ -16,10 +16,10 @@ function getLog(logIndex) { jobStatus.html("UNKNOWN"); }, 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(); } @@ -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');