Skip to content

Commit 864b8c5

Browse files
authored
chore: Lower job and transactions stored (#625)
* chore: Lower job and transactions stored * 25k failed jobs
1 parent 2c23fee commit 864b8c5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/utils/env.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ export const env = createEnv({
6161
ENABLE_HTTPS: boolSchema("false"),
6262
HTTPS_PASSPHRASE: z.string().default("thirdweb-engine"),
6363
TRUST_PROXY: z.boolean().default(false),
64+
// Sets the max amount of memory Redis can use.
65+
// "0" means use all available memory.
6466
REDIS_MAXMEMORY: z.string().default("0"),
65-
// TRANSACTION_HISTORY_COUNT defines the max transaction details to keep.
66-
// In testing, storing about 300k consumes 900mb memory.
67-
TRANSACTION_HISTORY_COUNT: z.coerce.number().default(300_000),
67+
// Sets the number of recent transactions to store. Older transactions are pruned periodically.
68+
// In testing, 100k transactions consumes ~300mb memory.
69+
TRANSACTION_HISTORY_COUNT: z.coerce.number().default(100_000),
6870
CLIENT_ANALYTICS_URL: z
6971
.union([UrlSchema, z.literal("")])
7072
.default("https://c.thirdweb.com/event"),

src/worker/queues/queues.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ import { env } from "../../utils/env";
33
import { logger } from "../../utils/logger";
44

55
export const defaultJobOptions: JobsOptions = {
6+
// Does not retry by default. Queues must explicitly define their own retry count and backoff behavior.
67
attempts: 0,
78
// Purges successful jobs.
89
removeOnComplete: {
910
age: 7 * 24 * 60 * 60,
1011
count: 10_000,
1112
},
1213
// Purge failed jobs.
13-
// These limits should be sufficiently high to debug/retry.
14+
// These limits are higher to debug or retry failed jobs.
1415
removeOnFail: {
1516
age: 7 * 24 * 60 * 60,
16-
count: 100_000,
17+
count: 25_000,
1718
},
1819
};
1920

0 commit comments

Comments
 (0)