feat(catalog-backend): Add configuration parameters for deferred stitcher
Allows for settings the stitch timeout and polling interval. Signed-off-by: Łukasz Jernaś <lukasz.jernas@allegro.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Add configuration parameters for deferred stitcher
|
||||
Vendored
+4
@@ -156,6 +156,10 @@ export interface Config {
|
||||
| {
|
||||
/** Defer stitching to be performed asynchronously */
|
||||
mode: 'deferred';
|
||||
/** Polling interval for tasks in seconds */
|
||||
pollingInterval?: number;
|
||||
/** How long to wait for a stitch to complete before giving up in seconds */
|
||||
stitchTimeout?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,11 +66,15 @@ export function stitchingStrategyFromConfig(config: Config): StitchingStrategy {
|
||||
mode: 'immediate',
|
||||
};
|
||||
} else if (strategyMode === 'deferred') {
|
||||
// TODO(freben): Make parameters configurable
|
||||
const pollingInterval =
|
||||
config.getOptionalNumber('catalog.stitchingStrategy.pollingInterval') ??
|
||||
1;
|
||||
const stitchTimeout =
|
||||
config.getOptionalNumber('catalog.stitchingStrategy.stitchTimeout') ?? 60;
|
||||
return {
|
||||
mode: 'deferred',
|
||||
pollingInterval: { seconds: 1 },
|
||||
stitchTimeout: { seconds: 60 },
|
||||
pollingInterval: { seconds: pollingInterval },
|
||||
stitchTimeout: { seconds: stitchTimeout },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user