From 9883b003d66672cfdf0611a565f1e8af6fd5dda6 Mon Sep 17 00:00:00 2001 From: adolfintel Date: Tue, 7 May 2019 17:05:26 +0200 Subject: [PATCH] Improve Performance API usage in server_selector.js --- Frontend/server_selector.js | 4 ++-- Frontend/server_selector.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Frontend/server_selector.js b/Frontend/server_selector.js index a693ac583..4600a5eba 100644 --- a/Frontend/server_selector.js +++ b/Frontend/server_selector.js @@ -21,8 +21,8 @@ function ping(url, result) { var instspd = new Date().getTime() - t; //rough timing estimate try { //try to get more accurate timing using performance API - var p = performance.getEntries(); - p = p[p.length - 1]; + var p = performance.getEntriesByName(url); + p=p[p.length-1]; var d = p.responseStart - p.requestStart; if (d <= 0) d = p.duration; if (d > 0 && d < instspd) instspd = d; diff --git a/Frontend/server_selector.min.js b/Frontend/server_selector.min.js index 7aabfdc55..22a008b08 100644 --- a/Frontend/server_selector.min.js +++ b/Frontend/server_selector.min.js @@ -1 +1 @@ -var PING_TIMEOUT=1e3,USE_PING_TIMEOUT=!0;function ping(url,result){var xhr=new XMLHttpRequest,t=(new Date).getTime();if(xhr.onload=function(){if(0==xhr.responseText.length){var instspd=(new Date).getTime()-t;try{var p=performance.getEntries(),d=(p=p[p.length-1]).responseStart-p.requestStart;d<=0&&(d=p.duration),0