A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: guard meilisearch client init with mutex
Mohamed Bassem35a259dd189e
diff --git a/packages/plugins/search-meilisearch/src/index.ts b/packages/plugins/search-meilisearch/src/index.tsindex 30da4a64..8ffd48cf 100644--- a/packages/plugins/search-meilisearch/src/index.ts+++ b/packages/plugins/search-meilisearch/src/index.ts@@ -80,6 +80,7 @@ class MeiliSearchIndexClient implements SearchIndexClient {export class MeiliSearchProvider implements PluginProvider<SearchIndexClient> {private client: MeiliSearch | undefined;private indexClient: SearchIndexClient | undefined;+ private initPromise: Promise<SearchIndexClient | null> | undefined;private readonly indexName = "bookmarks";constructor() {@@ -100,6 +101,17 @@ export class MeiliSearchProvider implements PluginProvider<SearchIndexClient> {return this.indexClient;}+ if (this.initPromise) {+ return this.initPromise;+ }++ this.initPromise = this.initClient();+ const client = await this.initPromise;+ this.initPromise = undefined;+ return client;+ }++ private async initClient(): Promise<SearchIndexClient | null> {if (!this.client) {return null;}