mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -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
|
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[]> {
|
export async function getHistory(query: string): Promise<browser.history.HistoryItem[]> {
|
||||||
// Search history, dedupe and sort by frecency
|
// Search history, dedupe and sort by frecency
|
||||||
let history = await browserBg.history.search({
|
let history = await (async _ => {
|
||||||
text: query,
|
await sleep(Math.random() * 1000)
|
||||||
maxResults: config.get("historyresults"),
|
return browserBg.history.search({
|
||||||
startTime: 0,
|
text: query,
|
||||||
})
|
maxResults: config.get("historyresults"),
|
||||||
|
startTime: 0,
|
||||||
|
})
|
||||||
|
})()
|
||||||
|
|
||||||
// Remove entries with duplicate URLs
|
// Remove entries with duplicate URLs
|
||||||
const dedupe = new Map()
|
const dedupe = new Map()
|
||||||
|
|
Loading…
Add table
Reference in a new issue