File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
import superjson from "superjson" ;
2
+ import { env } from "../../utils/env" ;
2
3
import { redis } from "../../utils/redis/redis" ;
3
4
import { AnyTransaction } from "../../utils/transaction/types" ;
4
5
@@ -38,8 +39,6 @@ export class TransactionDB {
38
39
private static cancelledTransactionsKey = `transaction:cancelled` ;
39
40
private static erroredTransactionsKey = `transaction:errored` ;
40
41
41
- static COMPLETED_TRANSACTIONS_MAX_AGE_SECONDS = 2 * 24 * 60 * 60 ; // 2 days
42
-
43
42
/**
44
43
* Inserts or replaces a transaction details.
45
44
* Also adds to the appropriate "status" sorted set.
@@ -54,9 +53,10 @@ export class TransactionDB {
54
53
transaction . status ,
55
54
) ;
56
55
if ( shouldExpire ) {
56
+ const ttlSeconds = env . PRUNE_TRANSACTIONS * 24 * 60 * 60 ;
57
57
pipeline . setex (
58
58
this . transactionDetailsKey ( transaction . queueId ) ,
59
- this . COMPLETED_TRANSACTIONS_MAX_AGE_SECONDS ,
59
+ ttlSeconds ,
60
60
superjson . stringify ( transaction ) ,
61
61
) ;
62
62
} else {
You can’t perform that action at this time.
0 commit comments