Skip to content

Commit

Permalink
await artificial delay
Browse files Browse the repository at this point in the history
  • Loading branch information
konstrybakov committed Jul 25, 2024
1 parent 41ea531 commit 4a82362
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/api/email/jobs/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { Resend } from 'resend'

const resend = new Resend(process.env.RESEND_API_KEY)

const delay = (ms: number) => {
return new Promise(resolve => setTimeout(resolve, ms))
}

export const GET = async () => {
try {
logger.info('Starting `send-email` cron job')
Expand Down Expand Up @@ -67,5 +71,7 @@ export const GET = async () => {
logger.flush(() => {
console.log('Logger flushed')
})

await delay(1000)
}
}

0 comments on commit 4a82362

Please sign in to comment.