From: Cesar Velez Date: Thu, 4 Jan 2018 17:56:12 +0000 (-0500) Subject: LP#1739504 - Fire off each ping sequentially X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=dce954faa677e6de2bbb389c1b38207fd77ead62;p=working%2FEvergreen.git LP#1739504 - Fire off each ping sequentially As suggested by berick, tweaking latency tester to sequentially fire off pings. Signed-off by: Cesar Velez --- diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index b42503b13b..b05fe262fc 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -948,7 +948,7 @@ function($scope , egCore , ngToast) { $scope.avrg = 0; // avrg latency $scope.canCopyCommand = document.queryCommandSupported('copy'); var numPings = 0; - // fetch first 10 + // initially fetch first 10 (gets a decent average) function calcAverage(){ @@ -967,7 +967,7 @@ function($scope , egCore , ngToast) { function ping(){ $scope.isTesting = true; var t = Date.now(); - egCore.net.request( + return egCore.net.request( "open-ils.pcrud", "opensrf.system.echo", "ping" ).then(function(resp){ var t2 = Date.now(); @@ -988,9 +988,14 @@ function($scope , egCore , ngToast) { if (numPings >= 10){ ping(); // just ping once after the initial ten } else { - for (var i=0; i<10; i++){ - ping(); - } + ping() + .then($scope.testLatency) + .then(function(){ + if (numPings == 9){ + $scope.tests.shift(); // toss first result + $scope.avrg = calcAverage(); + } + }); } }