File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed
modules/users/repositories Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -90,17 +90,11 @@ export class AxiosService {
9090 const nodeUrl = this . getNodeUrl ( url , StartXrayCommand . url , port ) ;
9191
9292 try {
93- // TODO: Remove this log
94- this . logger . log (
95- `Uncompressed data size: ${ prettyBytesUtil ( JSON . stringify ( data ) . length ) } ` ,
96- ) ;
97-
98- const ct = getTime ( ) ;
99-
93+ const startTime = getTime ( ) ;
10094 const compressedData = await this . compressData ( data ) ;
10195
10296 this . logger . log (
103- `Compressed data in: ${ formatExecutionTime ( ct ) } , size: ${ prettyBytesUtil ( compressedData . length ) } ` ,
97+ `[ZSTD] ${ formatExecutionTime ( startTime ) } | ${ prettyBytesUtil ( compressedData . length ) } ` ,
10498 ) ;
10599
106100 const response = await this . axiosInstance . post < StartXrayCommand . Response > (
Original file line number Diff line number Diff line change 11import ms from 'enhanced-ms' ;
22
33export function formatExecutionTime ( startTime : number ) : string {
4- return ms ( Date . now ( ) - startTime , 'short' ) || '0ms' ;
4+ return (
5+ ms ( performance . now ( ) - startTime , {
6+ extends : 'short' ,
7+ includeMs : true ,
8+ } ) || '0ms'
9+ ) ;
510}
611
712export function getTime ( ) : number {
8- return Date . now ( ) ;
13+ return performance . now ( ) ;
914}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { TransactionalAdapterPrisma } from '@nestjs-cls/transactional-adapter-pr
99import { TransactionHost } from '@nestjs-cls/transactional' ;
1010import { Injectable , Logger } from '@nestjs/common' ;
1111
12+ import { formatExecutionTime , getTime } from '@common/utils/get-elapsed-time' ;
1213import { TxKyselyService } from '@common/database/tx-kysely.service' ;
1314import { getKyselyUuid } from '@common/helpers/kysely' ;
1415import { GetAllUsersCommand } from '@libs/contracts/commands' ;
@@ -733,10 +734,10 @@ export class UsersRepository {
733734 . orderBy ( sql < string > `users.t_id asc` )
734735 . limit ( BATCH_SIZE ) ;
735736
736- const start = performance . now ( ) ;
737+ const startTime = getTime ( ) ;
737738 const result = await builder . execute ( ) ;
738739 this . logger . log (
739- `[getUsersForConfigStream] ${ performance . now ( ) - start } ms , length: ${ result . length } ` ,
740+ `[getUsersForConfigStream] ${ formatExecutionTime ( startTime ) } , length: ${ result . length } ` ,
740741 ) ;
741742
742743 if ( result . length < BATCH_SIZE ) {
You can’t perform that action at this time.
0 commit comments