Skip to content

Commit ac333c3

Browse files
committed
Merge branch 'chore/add-postman-queue-rate-limit' into donotmerge/staging-load-test
2 parents 5281e31 + ff35aa2 commit ac333c3

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

packages/backend/src/apps/postman/common/throw-errors.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,11 @@ export function throwPostmanStepError({
9292
}
9393
case 'RATE-LIMITED':
9494
// this will be auto-retried later on
95-
throw new StepError(
96-
'Rate limit exceeded',
97-
'Too many emails are being sent. Please wait for a while before retrying.',
98-
position,
99-
appName,
100-
error,
101-
)
95+
throw new RetriableError({
96+
error: error.details,
97+
delayInMs: 'default',
98+
delayType: 'queue',
99+
})
102100
case 'INVALID-ATTACHMENT':
103101
throw new StepError(
104102
'Unsupported attachment file type',

packages/backend/src/apps/postman/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { IApp } from '@plumber/types'
22

3-
import { getGenericAppQueue } from '@/queues/helpers/get-generic-app-queue'
4-
53
import actions from './actions'
4+
import queue from './queue'
65

76
const app: IApp = {
87
name: 'Email by Postman',
@@ -21,7 +20,7 @@ const app: IApp = {
2120
url: 'https://demo.arcade.software/VppMAbGKfFXFEsKxnKiw?embed&show_copy_link=true',
2221
title: 'Setting up Email by Postman',
2322
},
24-
queue: getGenericAppQueue('POSTMAN_EMAIL'),
23+
queue,
2524
category: 'communication',
2625
}
2726

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { IAppQueue } from '@plumber/types'
2+
3+
import appConfig from '@/config/app'
4+
5+
const queueSettings = {
6+
queueRateLimit: {
7+
duration: 1000,
8+
max: appConfig.postman.rateLimit,
9+
},
10+
isQueueDelayable: true,
11+
} satisfies IAppQueue
12+
13+
export default queueSettings
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const QUEUE_CONCURRENCY = {
2-
POSTMAN_EMAIL: 3,
2+
// POSTMAN_EMAIL: 3, // overridden in app config
33
SLACK: 3,
44
TELEGRAM: 3,
55
}

0 commit comments

Comments
 (0)