@@ -62,8 +62,8 @@ export interface IncrementalEntityProviderOptions {
|
||||
backoff?: DurationObjectUnits[];
|
||||
burstInterval: DurationObjectUnits;
|
||||
burstLength: DurationObjectUnits;
|
||||
rejectEmptyEntityCollections?: boolean;
|
||||
removalThreshold?: number;
|
||||
rejectEmptySourceCollections?: boolean;
|
||||
rejectRemovalsAbovePercentage?: number;
|
||||
restLength: DurationObjectUnits;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -283,7 +283,7 @@ export class IncrementalIngestionEngine implements IterationEngine {
|
||||
const { total } = result;
|
||||
|
||||
let doRemoval = true;
|
||||
if (this.options.rejectEmptyEntityCollections) {
|
||||
if (this.options.rejectEmptySourceCollections) {
|
||||
if (total === 0) {
|
||||
this.options.logger.error(
|
||||
`incremental-engine: Ingestion '${id}': Rejecting empty entity collection!`,
|
||||
@@ -292,12 +292,12 @@ export class IncrementalIngestionEngine implements IterationEngine {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.removalThreshold) {
|
||||
if (this.options.rejectRemovalsAbovePercentage) {
|
||||
// If the total entities upserted in this ingestion is 0, then
|
||||
// 100% of entities are stale and marked for removal.
|
||||
const percentRemoved =
|
||||
total > 0 ? (result.removed.length / total) * 100 : 100;
|
||||
if (percentRemoved <= this.options.removalThreshold) {
|
||||
if (percentRemoved <= this.options.rejectRemovalsAbovePercentage) {
|
||||
this.options.logger.info(
|
||||
`incremental-engine: Ingestion '${id}': Removing ${result.removed.length} entities that have no matching assets`,
|
||||
);
|
||||
|
||||
@@ -129,15 +129,15 @@ export interface IncrementalEntityProviderOptions {
|
||||
* Backstage removing all associated entities. To avoid that, set
|
||||
* a percentage of entities past which removal will be disallowed.
|
||||
*/
|
||||
removalThreshold?: number;
|
||||
rejectRemovalsAbovePercentage?: number;
|
||||
|
||||
/**
|
||||
* Similar to the removalThreshold, this option prevents removals
|
||||
* in circumstances where a data source has improperly returned 0
|
||||
* assets. If set to `true`, Backstage will reject removals when
|
||||
* that happens.
|
||||
* Similar to the rejectRemovalsAbovePercentage, this option
|
||||
* prevents removals in circumstances where a data source has
|
||||
* improperly returned 0 assets. If set to `true`, Backstage will
|
||||
* reject removals when that happens.
|
||||
*/
|
||||
rejectEmptyEntityCollections?: boolean;
|
||||
rejectEmptySourceCollections?: boolean;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
@@ -162,6 +162,6 @@ export interface IterationEngineOptions {
|
||||
restLength: DurationObjectUnits;
|
||||
ready: Promise<void>;
|
||||
backoff?: IncrementalEntityProviderOptions['backoff'];
|
||||
removalThreshold?: number;
|
||||
rejectEmptyEntityCollections?: boolean;
|
||||
rejectRemovalsAbovePercentage?: number;
|
||||
rejectEmptySourceCollections?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user