Skip to content

Commit

Permalink
chore: Pass retryStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Jan 7, 2025
1 parent 9e868ac commit b924320
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/artisan/src/lib/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { env } from "../env";
import type { PutObjectCommandInput } from "@aws-sdk/client-s3";
import type { CommandInput } from "s3-sync-client";

const retryStrategy = new ConfiguredRetryStrategy(5, 60_000);

const client = new S3({
endpoint: env.S3_ENDPOINT,
region: env.S3_REGION,
Expand All @@ -17,13 +19,10 @@ const client = new S3({
secretAccessKey: env.S3_SECRET_KEY,
},
logger: console,
retryStrategy: new ConfiguredRetryStrategy(
10,
(attempt) => 1000 + attempt * 1000,
),
retryStrategy,
});

const { sync } = new S3SyncClient({ client });
const { sync } = new S3SyncClient({ client, retryStrategy });

export async function syncFromS3(remotePath: string, localPath: string) {
await sync(`s3://${env.S3_BUCKET}/${remotePath}`, localPath);
Expand Down

0 comments on commit b924320

Please sign in to comment.