From 8bf5e11529f56563055f28680ded42934aef7c43 Mon Sep 17 00:00:00 2001 From: RobinTF <83676088+RobinTF@users.noreply.github.com> Date: Mon, 20 Nov 2023 23:14:16 +0100 Subject: [PATCH] Enhance documentation --- backend/static/js/helper.js | 2 ++ backend/static/js/qleverUI.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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 = $("