feat: add env to active skip transaction feature

pull/132/head
shancheas 2025-05-09 06:44:17 +07:00
parent e92f325807
commit 94baf956dd
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,9 @@ export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
) {} ) {}
async handle(event: ChangeDocEvent) { async handle(event: ChangeDocEvent) {
const envSkipTransaction = process.env.SKIP_TRANSACTION_FEATURE ?? 'false';
const activeSkipTransaction = envSkipTransaction == 'true';
const apmTransactions = apm.startTransaction( const apmTransactions = apm.startTransaction(
`ChangeDocEvent ${event?.data?.database}`, `ChangeDocEvent ${event?.data?.database}`,
'handler', 'handler',
@ -107,6 +110,7 @@ export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
// Check if this transaction should be sent to the "black hole" (not saved) // Check if this transaction should be sent to the "black hole" (not saved)
// This is only applicable for SETTLED transactions // This is only applicable for SETTLED transactions
const shouldSkipSaving = const shouldSkipSaving =
activeSkipTransaction &&
data.status === STATUS.SETTLED && data.status === STATUS.SETTLED &&
(await this.formulaService.sentToBlackHole()); (await this.formulaService.sentToBlackHole());