diff --git a/typescript/infra/src/agents/aws/validator.ts b/typescript/infra/src/agents/aws/validator.ts index 0396b3d63..cb6690753 100644 --- a/typescript/infra/src/agents/aws/validator.ts +++ b/typescript/infra/src/agents/aws/validator.ts @@ -50,7 +50,7 @@ export class S3Validator extends BaseValidator { this.s3Bucket = new S3Wrapper(s3Bucket); } - async compare(other: S3Validator): Promise { + async compare(other: S3Validator, count = 20): Promise { const latestCheckpointIndex = await this.s3Bucket.getS3Obj( LATEST_KEY, ); @@ -84,7 +84,9 @@ export class S3Validator extends BaseValidator { }; } - for (; checkpointIndex > 0; checkpointIndex--) { + const stop = Math.max(maxIndex - count, 0); + + for (; checkpointIndex > stop; checkpointIndex--) { const expected = await other.getCheckpointReceipt(checkpointIndex); const actual = await this.getCheckpointReceipt(checkpointIndex); @@ -118,7 +120,7 @@ export class S3Validator extends BaseValidator { checkpointMetrics[checkpointIndex] = metric; } - return checkpointMetrics; + return checkpointMetrics.slice(-1 * count); } private async getCheckpointReceipt(