mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Debug: add stochastic delay to history search
Trying to chase down the 'laggy' input issue that I experience on Windows.
This commit is contained in:
parent
7e42e32bd9
commit
ed9af15942
1 changed files with 10 additions and 5 deletions
|
@ -42,13 +42,18 @@ function frecency(item: browser.history.HistoryItem) {
|
|||
return item.visitCount * -1
|
||||
}
|
||||
|
||||
const sleep = async time_ms => new Promise(resolve => setTimeout(resolve, time_ms))
|
||||
|
||||
export async function getHistory(query: string): Promise<browser.history.HistoryItem[]> {
|
||||
// Search history, dedupe and sort by frecency
|
||||
let history = await browserBg.history.search({
|
||||
text: query,
|
||||
maxResults: config.get("historyresults"),
|
||||
startTime: 0,
|
||||
})
|
||||
let history = await (async _ => {
|
||||
await sleep(Math.random() * 1000)
|
||||
return browserBg.history.search({
|
||||
text: query,
|
||||
maxResults: config.get("historyresults"),
|
||||
startTime: 0,
|
||||
})
|
||||
})()
|
||||
|
||||
// Remove entries with duplicate URLs
|
||||
const dedupe = new Map()
|
||||
|
|
Loading…
Add table
Reference in a new issue