Removed unused processQueue
This commit is contained in:
@@ -45,7 +45,6 @@
|
||||
"lodash-es": "4.17.21",
|
||||
"minisearch": "github:scambier/minisearch#callback_desync",
|
||||
"obsidian-text-extract": "1.0.1",
|
||||
"p-limit": "^4.0.0",
|
||||
"pure-md5": "^0.1.14"
|
||||
},
|
||||
"pnpm": {
|
||||
|
||||
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@@ -24,7 +24,6 @@ specifiers:
|
||||
minisearch: github:scambier/minisearch#callback_desync
|
||||
obsidian: latest
|
||||
obsidian-text-extract: 1.0.1
|
||||
p-limit: ^4.0.0
|
||||
prettier: ^2.7.1
|
||||
prettier-plugin-svelte: ^2.8.0
|
||||
pure-md5: ^0.1.14
|
||||
@@ -42,7 +41,6 @@ dependencies:
|
||||
lodash-es: 4.17.21
|
||||
minisearch: github.com/scambier/minisearch/adf11cab46d851220a41c9ad95ed986b630f0f3c
|
||||
obsidian-text-extract: 1.0.1
|
||||
p-limit: 4.0.0
|
||||
pure-md5: 0.1.14
|
||||
|
||||
devDependencies:
|
||||
|
||||
@@ -4,8 +4,7 @@ import type { IndexedDocument } from './globals'
|
||||
|
||||
export class OmnisearchCache extends Dexie {
|
||||
public static readonly dbVersion = 7
|
||||
public static readonly dbPrefix = 'omnisearch/cache/'
|
||||
public static readonly dbName = OmnisearchCache.dbPrefix + app.appId
|
||||
public static readonly dbName = 'omnisearch/cache/' + app.appId
|
||||
|
||||
private static instance: OmnisearchCache
|
||||
|
||||
@@ -15,7 +14,7 @@ export class OmnisearchCache extends Dexie {
|
||||
public static async clearOldDatabases(): Promise<void> {
|
||||
const toDelete = (await indexedDB.databases()).filter(
|
||||
db =>
|
||||
db.name?.startsWith(OmnisearchCache.dbPrefix) &&
|
||||
db.name === OmnisearchCache.dbName &&
|
||||
// version multiplied by 10 https://github.com/dexie/Dexie.js/issues/59
|
||||
db.version !== OmnisearchCache.dbVersion * 10
|
||||
)
|
||||
|
||||
@@ -10,8 +10,7 @@ import * as NotesIndex from './notes-index'
|
||||
import type { TFile } from 'obsidian'
|
||||
import type { IndexedDocument } from './globals'
|
||||
import { getNonExistingNotes } from './tools/notes'
|
||||
import { database } from './database'
|
||||
import { getImageText, getPdfText } from 'obsidian-text-extract'
|
||||
import { getPdfText } from 'obsidian-text-extract'
|
||||
|
||||
/**
|
||||
* Return all plaintext files as IndexedDocuments
|
||||
|
||||
@@ -85,7 +85,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
}
|
||||
|
||||
onunload(): void {
|
||||
NotesIndex.processQueue.clearQueue()
|
||||
|
||||
}
|
||||
|
||||
addRibbonButton(): void {
|
||||
|
||||
@@ -4,15 +4,9 @@ import { removeAnchors } from './tools/notes'
|
||||
import { settings } from './settings'
|
||||
import { SearchEngine } from './search/search-engine'
|
||||
import { cacheManager } from './cache-manager'
|
||||
import pLimit from 'p-limit'
|
||||
import type { IndexedDocument } from './globals'
|
||||
import { fileToIndexedDocument } from './file-loader'
|
||||
|
||||
/**
|
||||
* Use this processing queue to handle all heavy work
|
||||
*/
|
||||
export const processQueue = pLimit(settings.backgroundProcesses)
|
||||
|
||||
/**
|
||||
* Adds a file to the search index
|
||||
* @param file
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Notice,
|
||||
Platform,
|
||||
Plugin,
|
||||
PluginSettingTab,
|
||||
Setting,
|
||||
@@ -26,8 +25,6 @@ export interface OmnisearchSettings extends WeightingSettings {
|
||||
indexedFileTypes: string[]
|
||||
/** Enable PDF indexing */
|
||||
PDFIndexing: boolean
|
||||
/** Max number of spawned processes for background tasks, such as extracting text from PDFs */
|
||||
backgroundProcesses: number
|
||||
/** Display Omnisearch popup notices over Obsidian */
|
||||
showIndexingNotices: boolean
|
||||
/** Activate the small 🔍 button on Obsidian's ribbon */
|
||||
@@ -313,20 +310,11 @@ export class SettingsTab extends PluginSettingTab {
|
||||
}
|
||||
}
|
||||
|
||||
// Determining the maximum concurrent processes/workers/promises for heavy work,
|
||||
// without hogging all the resources.
|
||||
const cpuCount = Platform.isMobileApp ? 1 : require('os').cpus().length
|
||||
let backgroundProcesses = Math.max(1, Math.floor(cpuCount * 0.75))
|
||||
if (backgroundProcesses == cpuCount) {
|
||||
backgroundProcesses = 1
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
||||
respectExcluded: true,
|
||||
ignoreDiacritics: true,
|
||||
indexedFileTypes: [] as string[],
|
||||
PDFIndexing: false,
|
||||
backgroundProcesses,
|
||||
|
||||
showIndexingNotices: false,
|
||||
showShortName: false,
|
||||
|
||||
Reference in New Issue
Block a user