diff --git a/backend/static/js/helper.js b/backend/static/js/helper.js index c547a54b..993e9899 100644 --- a/backend/static/js/helper.js +++ b/backend/static/js/helper.js @@ -52,6 +52,7 @@ function appendRuntimeInformation(runtime_info, query, time, queryUpdate) { parseInt(time["total"].toString().replace(/ms/, ""), 10); const previousTimeStamp = request_log.get(queryUpdate.queryId)?.timeStamp || Number.MIN_VALUE; + // If newer runtime info for existing query or new query. if (previousTimeStamp < queryUpdate.updateTimeStamp) { request_log.set(queryUpdate.queryId, { timeStamp: queryUpdate.updateTimeStamp, @@ -59,6 +60,7 @@ function appendRuntimeInformation(runtime_info, query, time, queryUpdate) { query: query }); if (request_log.size > 10) { + // Note: `keys().next()` is the key that was inserted first. request_log.delete(request_log.keys().next().value); } } diff --git a/backend/static/js/qleverUI.js b/backend/static/js/qleverUI.js index ad784be9..737f866f 100755 --- a/backend/static/js/qleverUI.js +++ b/backend/static/js/qleverUI.js @@ -6,12 +6,11 @@ var predicateNames = {}; var objectNames = {}; var high_query_time_ms = 100; var very_high_query_time_ms = 1000; -// Map guarantees to keep insertion order var request_log = new Map(); // Generates a random query id only known to this client. // We don't use consecutive ids to prevent clashes between -// several qlever-ui instances. +// different instances of the Qlever UI running at the same time. function generateQueryId() { if (window.isSecureContext) { return crypto.randomUUID(); @@ -805,6 +804,8 @@ function renderRuntimeInformationToDom(entry = undefined) { if ($('#logRequests').is(':checked')) { const queryHistoryList = $("