diff --git a/internal/index/manager/manager.go b/internal/index/manager/manager.go index 97e0045a..33a2b1d9 100644 --- a/internal/index/manager/manager.go +++ b/internal/index/manager/manager.go @@ -827,10 +827,16 @@ func (mgr *Manager) getIndexesCopy(start int) ([]*index.Reader, indexReleaser) { func (mgr *Manager) ClientConfig() ClientConfig { c := make(chan ClientConfig) - c <- ClientConfig{ - AutoInsertLimitToQuery: true, + mgr.jobs <- func() { + locks := uint(0) + for _, n := range mgr.usedIndexes { + locks += n + } + c <- ClientConfig{ + AutoInsertLimitToQuery: true, + } + close(c) } - close(c) res := <-c return res } diff --git a/web/src/components/SearchBox.vue b/web/src/components/SearchBox.vue index 54e442aa..20f721a6 100644 --- a/web/src/components/SearchBox.vue +++ b/web/src/components/SearchBox.vue @@ -231,6 +231,9 @@ watch( ); onMounted(() => { + store.getClientConfig().catch((err: string) => { + EventBus.emit("showError", `Failed to get clientconfig: ${err}`); + }); store.updateConverters().catch((err: string) => { EventBus.emit("showError", `Failed to update converters: ${err}`); }); diff --git a/web/src/stores/index.ts b/web/src/stores/index.ts index 33b92ba5..238beeaf 100644 --- a/web/src/stores/index.ts +++ b/web/src/stores/index.ts @@ -14,10 +14,10 @@ import APIClient, { interface State { status: Statistics | null; - clientConfig: ClientConfig | null; pcaps: PcapInfo[] | null; tags: TagInfo[] | null; converters: ConverterStatistics[] | null; + clientConfig: ClientConfig | null; pcapOverIPEndpoints: PcapOverIPEndpoint[] | null; } @@ -25,12 +25,12 @@ export const useRootStore = defineStore("root", { state: (): State => { setupWebsocket(); return { - clientConfig: null, status: null, pcaps: null, tags: null, converters: null, pcapOverIPEndpoints: null, + clientConfig: null, }; }, getters: { @@ -79,11 +79,6 @@ export const useRootStore = defineStore("root", { } } }, - async updateClientConfig() { - return APIClient.getClientConfig() - .then((data) => (this.clientConfig = data)) - .catch(handleAxiosDefaultError); - }, async updateStatus() { return APIClient.getStatus() .then((data) => (this.status = data)) @@ -118,6 +113,11 @@ export const useRootStore = defineStore("root", { .then((data) => (this.converters = data)) .catch(handleAxiosDefaultError); }, + async getClientConfig() { + return APIClient.getClientConfig() + .then((data) => (this.clientConfig = data)) + .catch(handleAxiosDefaultError); + }, async updatePcaps() { return APIClient.getPcaps() .then((data) => (this.pcaps = data))