Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3 clock skew #360

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions lib/providers/circuit-breaker/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export class S3CircuitBreakerConfigurationProvider implements CircuitBreakerConf
private log: Logger;
private fillers: CircuitBreakerConfiguration[];
private lastUpdatedTimestamp: number;
private client: S3Client;
allow_list: Set<string>;

// try to refetch endpoints every 5 mins
Expand All @@ -28,11 +27,6 @@ export class S3CircuitBreakerConfigurationProvider implements CircuitBreakerConf
this.log = _log.child({ quoter: 'S3CircuitBreakerConfigurationProvider' });
this.fillers = [];
this.lastUpdatedTimestamp = Date.now();
this.client = new S3Client({
requestHandler: new NodeHttpHandler({
requestTimeout: 500,
}),
});
this.allow_list = _allow_list;
}

Expand Down Expand Up @@ -79,7 +73,12 @@ export class S3CircuitBreakerConfigurationProvider implements CircuitBreakerConf

async fetchConfigurations(): Promise<void> {
try {
const s3Res = await this.client.send(
const client = new S3Client({
requestHandler: new NodeHttpHandler({
requestTimeout: 500,
}),
});
const s3Res = await client.send(
new GetObjectCommand({
Bucket: this.bucket,
Key: this.key,
Expand Down Expand Up @@ -110,7 +109,12 @@ export class S3CircuitBreakerConfigurationProvider implements CircuitBreakerConf
enabled: rate < S3CircuitBreakerConfigurationProvider.FILL_RATE_THRESHOLD,
});
}
await this.client.send(
const client = new S3Client({
requestHandler: new NodeHttpHandler({
requestTimeout: 500,
}),
});
await client.send(
new PutObjectCommand({
Bucket: this.bucket,
Key: this.key,
Expand Down
Loading