feat: add missing lifecycle monitoring for catalog, search and server

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-03-27 16:08:20 +02:00
parent 9624efb688
commit c6cb568f39
6 changed files with 45 additions and 9 deletions
+12 -4
View File
@@ -98,6 +98,7 @@ export default createBackendPlugin({
auth: coreServices.auth,
http: coreServices.httpRouter,
httpAuth: coreServices.httpAuth,
lifecycle: coreServices.rootLifecycle,
searchIndexService: searchIndexServiceRef,
},
async init({
@@ -108,6 +109,7 @@ export default createBackendPlugin({
auth,
http,
httpAuth,
lifecycle,
searchIndexService,
}) {
let searchEngine = searchEngineRegistry.getSearchEngine();
@@ -120,10 +122,16 @@ export default createBackendPlugin({
const collators = searchIndexRegistry.getCollators();
const decorators = searchIndexRegistry.getDecorators();
await searchIndexService.start({
searchEngine,
collators,
decorators,
lifecycle.addStartupHook(async () => {
await searchIndexService.start({
searchEngine: searchEngine!,
collators,
decorators,
});
});
lifecycle.addShutdownHook(async () => {
await searchIndexService.stop();
});
const router = await createRouter({