Merge pull request #10167 from backstage/rugvip/refresh

catalog-backend: removed deprecated refresh interval symbols
This commit is contained in:
Patrik Oldsberg
2022-03-14 12:55:38 +01:00
committed by GitHub
5 changed files with 12 additions and 78 deletions
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-catalog-backend': minor
---
**BREAKING**: Removed the following deprecated symbols:
- `catalogBuilder.setRefreshInterval`, use `catalogBuilder.setProcessingInterval` instead.
- `catalogBuilder.setRefreshIntervalSeconds`, use `catalogBuilder.setProcessingIntervalSeconds` instead.
- `createRandomRefreshInterval`, use `createRandomProcessingInterval` instead.
- `RefreshIntervalFunction`, use `ProcessingIntervalFunction` instead.
-13
View File
@@ -142,10 +142,6 @@ export class CatalogBuilder {
processingInterval: ProcessingIntervalFunction,
): CatalogBuilder;
setProcessingIntervalSeconds(seconds: number): CatalogBuilder;
// @deprecated
setRefreshInterval(refreshInterval: RefreshIntervalFunction): CatalogBuilder;
// @deprecated
setRefreshIntervalSeconds(seconds: number): CatalogBuilder;
}
// @alpha
@@ -324,12 +320,6 @@ export function createRandomProcessingInterval(options: {
maxSeconds: number;
}): ProcessingIntervalFunction;
// @public @deprecated
export function createRandomRefreshInterval(options: {
minSeconds: number;
maxSeconds: number;
}): RefreshIntervalFunction;
// @public
export function createRouter(options: RouterOptions): Promise<express.Router>;
@@ -811,9 +801,6 @@ export type RecursivePartial<T> = {
: T[P];
};
// @public @deprecated
export type RefreshIntervalFunction = () => number;
// @public
export type RefreshOptions = {
entityRef: string;
@@ -23,11 +23,5 @@ export type {
} from './types';
export { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator';
export {
createRandomRefreshInterval,
createRandomProcessingInterval,
} from './refresh';
export type {
RefreshIntervalFunction,
ProcessingIntervalFunction,
} from './refresh';
export { createRandomProcessingInterval } from './refresh';
export type { ProcessingIntervalFunction } from './refresh';
@@ -14,35 +14,12 @@
* limitations under the License.
*/
/**
* Function that returns the catalog refresh interval in seconds.
* @deprecated use {@link ProcessingIntervalFunction} instead
* @public
*/
export type RefreshIntervalFunction = () => number;
/**
* Function that returns the catalog processing interval in seconds.
* @public
*/
export type ProcessingIntervalFunction = () => number;
/**
* Creates a function that returns a random refresh interval between minSeconds and maxSeconds.
* @returns A {@link RefreshIntervalFunction} that provides the next refresh interval
* @deprecated use {@link createRandomProcessingInterval} instead
* @public
*/
export function createRandomRefreshInterval(options: {
minSeconds: number;
maxSeconds: number;
}): RefreshIntervalFunction {
const { minSeconds, maxSeconds } = options;
return () => {
return Math.random() * (maxSeconds - minSeconds) + minSeconds;
};
}
/**
* Creates a function that returns a random processing interval between minSeconds and maxSeconds.
* @returns A {@link ProcessingIntervalFunction} that provides the next processing interval
@@ -68,7 +68,6 @@ import { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatal
import { Stitcher } from '../stitching/Stitcher';
import {
createRandomProcessingInterval,
RefreshIntervalFunction,
ProcessingIntervalFunction,
} from '../processing/refresh';
import { createRouter } from './createRouter';
@@ -179,25 +178,6 @@ export class CatalogBuilder {
return this;
}
/**
* Refresh interval determines how often entities should be refreshed.
* Seconds provided will be multiplied by 1.5
* The default refresh duration is 100-150 seconds.
* setting this too low will potentially deplete request quotas to upstream services.
*
* @deprecated use {@link CatalogBuilder#setProcessingIntervalSeconds} instead
*/
setRefreshIntervalSeconds(seconds: number): CatalogBuilder {
this.env.logger.warn(
'[DEPRECATION] - CatalogBuilder.setRefreshIntervalSeconds is deprecated. Use CatalogBuilder.setProcessingIntervalSeconds instead.',
);
this.processingInterval = createRandomProcessingInterval({
minSeconds: seconds,
maxSeconds: seconds * 1.5,
});
return this;
}
/**
* Processing interval determines how often entities should be processed.
* Seconds provided will be multiplied by 1.5
@@ -212,20 +192,6 @@ export class CatalogBuilder {
return this;
}
/**
* Overwrites the default refresh interval function used to spread
* entity updates in the catalog.
*
* @deprecated use {@link CatalogBuilder#setProcessingInterval} instead
*/
setRefreshInterval(refreshInterval: RefreshIntervalFunction): CatalogBuilder {
this.env.logger.warn(
'[DEPRECATION] - CatalogBuilder.setRefreshInterval is deprecated. Use CatalogBuilder.setProcessingInterval instead.',
);
this.processingInterval = refreshInterval;
return this;
}
/**
* Overwrites the default processing interval function used to spread
* entity updates in the catalog.