UBERF-9501: Fix use of Date.now() (#8069)

This commit is contained in:
Andrey Sobolev
2025-02-21 19:46:13 +07:00
committed by GitHub
parent 4429d33c68
commit 3673078b11
24 changed files with 150 additions and 126 deletions
+8 -6
View File
@@ -16,6 +16,8 @@
import core, {
DOMAIN_MODEL,
cutObjectArray,
platformNow,
platformNowDiff,
type Class,
type Client,
type Doc,
@@ -86,7 +88,7 @@ export class PresentationClientHook implements ClientHook {
query: DocumentQuery<T>,
options?: FindOptions<T>
): Promise<WithLookup<T> | undefined> {
const startTime = Date.now()
const startTime = platformNow()
const isModel = client.getHierarchy().findDomain(_class) === DOMAIN_MODEL
const result = await client.findOne(_class, query, options)
if (this.notifyEnabled && !isModel) {
@@ -100,7 +102,7 @@ export class PresentationClientHook implements ClientHook {
' =>model',
client.getModel(),
getMetadata(devmodel.metadata.DevModel),
Date.now() - startTime,
platformNow() - startTime,
this.stackLine()
)
}
@@ -113,7 +115,7 @@ export class PresentationClientHook implements ClientHook {
query: DocumentQuery<T>,
options?: FindOptions<T>
): Promise<FindResult<T>> {
const startTime = Date.now()
const startTime = platformNow()
const isModel = client.getHierarchy().findDomain(_class) === DOMAIN_MODEL
const result = await client.findAll(_class, query, options)
if (this.notifyEnabled && !isModel) {
@@ -127,7 +129,7 @@ export class PresentationClientHook implements ClientHook {
' =>model',
client.getModel(),
getMetadata(devmodel.metadata.DevModel),
Date.now() - startTime,
platformNow() - startTime,
JSON.stringify(result).length,
this.stackLine()
)
@@ -150,7 +152,7 @@ export class PresentationClientHook implements ClientHook {
}
async tx (client: Client, tx: Tx): Promise<TxResult> {
const startTime = Date.now()
const startTime = platformNow()
const result = await client.tx(tx)
if (this.notifyEnabled && (tx as any).objectClass !== core.class.BenchmarkDoc) {
console.debug(
@@ -158,7 +160,7 @@ export class PresentationClientHook implements ClientHook {
testing ? JSON.stringify(cutObjectArray(tx)).slice(0, 160) : tx,
result,
getMetadata(devmodel.metadata.DevModel),
Date.now() - startTime,
platformNowDiff(startTime),
this.stackLine()
)
}