File tree Expand file tree Collapse file tree 2 files changed +24
-22
lines changed Expand file tree Collapse file tree 2 files changed +24
-22
lines changed Original file line number Diff line number Diff line change @@ -180,28 +180,27 @@ export class WinningsRepository {
180180 ! winnerIds && ! ! externalIds ?. length ,
181181 ) ;
182182
183- const [ winnings , count ] = await this . prisma . $transaction ( [
184- this . prisma . winnings . findMany ( {
185- where : queryWhere ,
186- include : {
187- payment : {
188- where : {
189- installment_number : 1 ,
190- } ,
191- orderBy : [
192- {
193- created_at : 'desc' ,
194- } ,
195- ] ,
183+ const winnings = await this . prisma . winnings . findMany ( {
184+ where : queryWhere ,
185+ include : {
186+ payment : {
187+ where : {
188+ installment_number : 1 ,
196189 } ,
197- origin : true ,
190+ orderBy : [
191+ {
192+ created_at : 'desc' ,
193+ } ,
194+ ] ,
198195 } ,
199- orderBy,
200- skip : searchProps . offset ,
201- take : searchProps . limit ,
202- } ) ,
203- this . prisma . winnings . count ( { where : queryWhere } ) ,
204- ] ) ;
196+ origin : true ,
197+ } ,
198+ orderBy,
199+ skip : searchProps . offset ,
200+ take : searchProps . limit ,
201+ } ) ;
202+
203+ const count = await this . prisma . winnings . count ( { where : queryWhere } ) ;
205204
206205 const usersPayoutStatusMap = winnings ?. length
207206 ? await this . getUsersPayoutStatusForWinnings ( winnings )
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ export class PrismaService
1414
1515 constructor ( ) {
1616 super ( {
17+ transactionOptions : {
18+ timeout : 20000 , // 20s
19+ } ,
1720 log : [
1821 { level : 'query' , emit : 'event' } ,
1922 { level : 'info' , emit : 'event' } ,
@@ -26,8 +29,8 @@ export class PrismaService
2629 this . $on ( 'query' as never , ( e : Prisma . QueryEvent ) => {
2730 const queryTime = e . duration ;
2831
29- // log slow queries (> 500ms )
30- if ( queryTime > 500 ) {
32+ // log slow queries (> 5s )
33+ if ( queryTime > 5000 ) {
3134 this . logger . warn (
3235 `Slow query detected! Duration: ${ queryTime } ms | Query: ${ e . query } ` ,
3336 ) ;
You can’t perform that action at this time.
0 commit comments