Skip to content

Commit

Permalink
feat: introduce timeout to s3 read requests
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj authored and dotansimha committed Aug 24, 2024
1 parent dacc302 commit 20da8c7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/services/cdn-worker/src/artifact-storage-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ type SDLArtifactTypes = `sdl${'.graphql' | '.graphqls' | ''}`;

export type ArtifactsType = SDLArtifactTypes | 'metadata' | 'services' | 'supergraph';

/** Timeout in milliseconds for S3 read calls. */
const READ_TIMEOUT_MS = 20_000;

const OperationS3BucketKeyModel = zod.tuple([
zod.string().uuid(),
zod.string().min(1),
Expand Down Expand Up @@ -85,6 +88,7 @@ export class ArtifactStorageReader {
headers: {
'X-Amz-Expires': String(presignedUrlExpirationSeconds),
},
timeout: READ_TIMEOUT_MS,
},
);

Expand Down Expand Up @@ -126,6 +130,7 @@ export class ArtifactStorageReader {
aws: {
signQuery: true,
},
timeout: READ_TIMEOUT_MS,
},
);
this.analytics?.track(
Expand Down Expand Up @@ -164,6 +169,7 @@ export class ArtifactStorageReader {
aws: {
signQuery: true,
},
timeout: READ_TIMEOUT_MS,
},
);
this.analytics?.track(
Expand Down Expand Up @@ -200,6 +206,7 @@ export class ArtifactStorageReader {
signQuery: true,
},
headers,
timeout: READ_TIMEOUT_MS,
},
);

Expand Down

0 comments on commit 20da8c7

Please sign in to comment.