feat: added the ability to disable catalog processing

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-10-10 09:41:07 +02:00
parent 05a0e54f6c
commit 1acd16ecbe
2 changed files with 23 additions and 5 deletions
+15 -1
View File
@@ -164,7 +164,6 @@ export interface Config {
/**
* The interval at which the catalog should process its entities.
*
* @remarks
*
* Example:
@@ -186,5 +185,20 @@ export interface Config {
* housing catalog-info files.
*/
processingInterval?: HumanDuration;
/**
* If the processing engine should be started or not, defaults to true.
* @remarks
*
* Example:
*
* ```yaml
* catalog:
* processingInterval: false
* ```
*
* This will enable or disable the processing of entities in the Catalog. This can be useful
* to use with Read Replica deployments of the catalog.
*/
processingEnabled?: boolean;
};
}
@@ -42,6 +42,7 @@ import {
import { merge } from 'lodash';
import { Permission } from '@backstage/plugin-permission-common';
import { ForwardedError } from '@backstage/errors';
import { constrainedMemory } from 'node:process';
class CatalogLocationsExtensionPointImpl
implements CatalogLocationsExtensionPoint
@@ -301,10 +302,13 @@ export const catalogPlugin = createBackendPlugin({
const { processingEngine, router } = await builder.build();
lifecycle.addStartupHook(async () => {
await processingEngine.start();
});
lifecycle.addShutdownHook(() => processingEngine.stop());
if (config.getOptionalBoolean('catalog.processingEnabled') ?? true) {
lifecycle.addStartupHook(async () => {
await processingEngine.start();
});
lifecycle.addShutdownHook(() => processingEngine.stop());
}
httpRouter.use(router);
},
});