From 04551a8132220168a868caace7b61480f3418556 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Sun, 1 Oct 2023 22:59:28 +0200 Subject: [PATCH] Don't await increase, limit to 2k for performance --- javascript/tagAutocomplete.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index d918711..2e5b2d0 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -491,7 +491,7 @@ async function insertTextAtCursor(textArea, result, tagword, tabCompletedWithout // Sanitize name for API call name = encodeURIComponent(name) // Call API & update db - await increaseUseCount(name, tagType) + increaseUseCount(name, tagType) } } @@ -1159,7 +1159,8 @@ async function autocomplete(textArea, prompt, fixedTag = null) { // Split our results into a list of names and types let names = []; let types = []; - results.forEach(r => { + // Limit to 2k for performance reasons + results.slice(0,2000).forEach(r => { const name = r.type === ResultType.chant ? r.aliases : r.text; names.push(name); types.push(r.type);