Skip to content

Commit 09a7377

Browse files
committed
update ttl seconds
1 parent e3d673b commit 09a7377

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/db/transactions/db.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import superjson from "superjson";
2+
import { env } from "../../utils/env";
23
import { redis } from "../../utils/redis/redis";
34
import { AnyTransaction } from "../../utils/transaction/types";
45

@@ -38,8 +39,6 @@ export class TransactionDB {
3839
private static cancelledTransactionsKey = `transaction:cancelled`;
3940
private static erroredTransactionsKey = `transaction:errored`;
4041

41-
static COMPLETED_TRANSACTIONS_MAX_AGE_SECONDS = 2 * 24 * 60 * 60; // 2 days
42-
4342
/**
4443
* Inserts or replaces a transaction details.
4544
* Also adds to the appropriate "status" sorted set.
@@ -54,9 +53,10 @@ export class TransactionDB {
5453
transaction.status,
5554
);
5655
if (shouldExpire) {
56+
const ttlSeconds = env.PRUNE_TRANSACTIONS * 24 * 60 * 60;
5757
pipeline.setex(
5858
this.transactionDetailsKey(transaction.queueId),
59-
this.COMPLETED_TRANSACTIONS_MAX_AGE_SECONDS,
59+
ttlSeconds,
6060
superjson.stringify(transaction),
6161
);
6262
} else {

0 commit comments

Comments
 (0)