Skip to content

Commit

Permalink
add retry to S3 client, update job to run every Saturday at 01:00
Browse files Browse the repository at this point in the history
  • Loading branch information
brankoEISI committed Jan 16, 2024
1 parent 2b11a06 commit bcb9067
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import axios from "axios"
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"

console.log(`CRON SERVER START`)
cron.schedule("*/30 * * * *", async () => {
cron.schedule("0 1 * * 6", async () => {
console.log("========== BEGIN CRON JOB ==========")
if (!process.env.GET_TOKEN_URL || !process.env.SERVICE_ACCOUNT_USERNAME || !process.env.SERVICE_ACCOUNT_PASSWORD
|| !process.env.GET_EVENTS_URL || !process.env.BUCKET || !process.env.BUCKET_KEY_ID || !process.env.BUCKET_KEY
Expand Down Expand Up @@ -75,7 +75,8 @@ const uploadFile = async(file: any) => {
accessKeyId: process.env.BUCKET_KEY_ID as string,
secretAccessKey: process.env.BUCKET_KEY as string,
},
retryMode: "standard"
retryMode: "standard",
maxAttempts: 3
})
const currentDate = getDateString(new Date())
const fileID = `${currentDate}-${process.env.ENVIRONMENT}`
Expand Down

0 comments on commit bcb9067

Please sign in to comment.