Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/shared/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export const env = createEnv({
QUEUE_FAIL_HISTORY_COUNT: z.coerce.number().default(10_000),
// Sets the number of recent nonces to map to queue IDs.
NONCE_MAP_COUNT: z.coerce.number().default(10_000),
// Sets the age (in seconds) after which completed or failed jobs are eligible for removal. Default: 7 days.
QUEUE_JOB_RETENTION_AGE_SECONDS: z.coerce.number().default(7 * 24 * 60 * 60),
// Overrides the cron schedule for contract subscription jobs.
CONTRACT_SUBSCRIPTION_CRON_SCHEDULE_OVERRIDE: z.string().optional(),

Expand Down Expand Up @@ -151,6 +153,7 @@ export const env = createEnv({
DD_TRACER_ACTIVATED: process.env.DD_TRACER_ACTIVATED,
QUEUE_COMPLETE_HISTORY_COUNT: process.env.QUEUE_COMPLETE_HISTORY_COUNT,
QUEUE_FAIL_HISTORY_COUNT: process.env.QUEUE_FAIL_HISTORY_COUNT,
QUEUE_JOB_RETENTION_AGE_SECONDS: process.env.QUEUE_JOB_RETENTION_AGE_SECONDS,
NONCE_MAP_COUNT: process.env.NONCE_MAP_COUNT,
CONTRACT_SUBSCRIPTION_CRON_SCHEDULE_OVERRIDE:
process.env.CONTRACT_SUBSCRIPTION_CRON_SCHEDULE_OVERRIDE,
Expand Down
4 changes: 2 additions & 2 deletions src/worker/queues/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export const defaultJobOptions: JobsOptions = {
// Does not retry by default. Queues must explicitly define their own retry count and backoff behavior.
attempts: 0,
removeOnComplete: {
age: 7 * 24 * 60 * 60,
age: env.QUEUE_JOB_RETENTION_AGE_SECONDS,
count: env.QUEUE_COMPLETE_HISTORY_COUNT,
},
removeOnFail: {
age: 7 * 24 * 60 * 60,
age: env.QUEUE_JOB_RETENTION_AGE_SECONDS,
count: env.QUEUE_FAIL_HISTORY_COUNT,
},
};
Expand Down
Loading