mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 01:57:31 +01:00
Lazy initialize company search route service
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
c88a1e894d
commit
5264bdf422
1 file changed
+6
-2
@@ -487,7 +487,11 @@ export function issueRoutes(
|
||||
});
|
||||
const feedback = feedbackService(db);
|
||||
const companiesSvc = companyService(db);
|
||||
const searchSvc = opts.searchService ?? companySearchService(db);
|
||||
let searchSvc = opts.searchService ?? null;
|
||||
const getSearchService = () => {
|
||||
searchSvc ??= companySearchService(db);
|
||||
return searchSvc;
|
||||
};
|
||||
const searchRateLimiter = opts.searchRateLimiter ?? defaultCompanySearchRateLimiter;
|
||||
const instanceSettings = instanceSettingsService(db);
|
||||
const agentsSvc = agentService(db);
|
||||
@@ -993,7 +997,7 @@ export function issueRoutes(
|
||||
});
|
||||
return;
|
||||
}
|
||||
const result = await searchSvc.search(companyId, query);
|
||||
const result = await getSearchService().search(companyId, query);
|
||||
res.json(result);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user