chore: support processingInterval as false
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Adds the ability to disable catalog processing with `catalog.processingEnabled` config flag
|
||||
Adds the ability to disable catalog processing `catalog.processingInterval: false` in `app-config`
|
||||
|
||||
Vendored
+8
-2
@@ -173,6 +173,13 @@ export interface Config {
|
||||
* processingInterval: { minutes: 30 }
|
||||
* ```
|
||||
*
|
||||
* or to disabled processing:
|
||||
*
|
||||
* ```yaml
|
||||
* catalog:
|
||||
* processingInterval: false
|
||||
* ```
|
||||
*
|
||||
* Note that this is only a suggested minimum, and the actual interval may
|
||||
* be longer. Internally, the catalog will scale up this number by a small
|
||||
* factor and choose random numbers in that range to spread out the load. If
|
||||
@@ -184,7 +191,7 @@ export interface Config {
|
||||
* systems that are queried by processors, such as version control systems
|
||||
* housing catalog-info files.
|
||||
*/
|
||||
processingInterval?: HumanDuration;
|
||||
processingInterval?: HumanDuration | false;
|
||||
/**
|
||||
* If the processing engine should be started or not, defaults to true.
|
||||
* @remarks
|
||||
@@ -199,6 +206,5 @@ export interface Config {
|
||||
* 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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -843,9 +843,18 @@ export class CatalogBuilder {
|
||||
});
|
||||
}
|
||||
|
||||
if (!Boolean(config.get('catalog.processingInterval'))) {
|
||||
return () => {
|
||||
throw new Error(
|
||||
'catalog.processingInterval is set to false, processing is disabled.',
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
const duration = readDurationFromConfig(config, {
|
||||
key: processingIntervalKey,
|
||||
});
|
||||
|
||||
const seconds = Math.max(
|
||||
1,
|
||||
Math.round(durationToMilliseconds(duration) / 1000),
|
||||
|
||||
@@ -302,7 +302,7 @@ export const catalogPlugin = createBackendPlugin({
|
||||
|
||||
const { processingEngine, router } = await builder.build();
|
||||
|
||||
if (config.getOptionalBoolean('catalog.processingEnabled') ?? true) {
|
||||
if (config.get('catalog.processingInterval') ?? true) {
|
||||
lifecycle.addStartupHook(async () => {
|
||||
await processingEngine.start();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user