diff --git a/BE/src/stockSocket/stock-execute-order.repository.ts b/BE/src/stockSocket/stock-execute-order.repository.ts index b0c3d4e..4bede4d 100644 --- a/BE/src/stockSocket/stock-execute-order.repository.ts +++ b/BE/src/stockSocket/stock-execute-order.repository.ts @@ -29,7 +29,7 @@ export class StockExecuteOrderRepository extends Repository { async checkExecutableOrder(stockCode, value) { const queryRunner = this.dataSource.createQueryRunner(); - await queryRunner.startTransaction('SERIALIZABLE'); + await queryRunner.startTransaction(); try { const buyOrders = await queryRunner.manager.find(Order, { @@ -39,6 +39,9 @@ export class StockExecuteOrderRepository extends Repository { status: StatusType.PENDING, price: MoreThanOrEqual(value), }, + lock: { + mode: 'pessimistic_write', + }, }); const sellOrders = await queryRunner.manager.find(Order, { @@ -48,6 +51,9 @@ export class StockExecuteOrderRepository extends Repository { status: StatusType.PENDING, price: LessThanOrEqual(value), }, + lock: { + mode: 'pessimistic_write', + }, }); await Promise.all(