mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 20:14:57 +02:00
UBERF-9501: Fix use of Date.now() (#8069)
This commit is contained in:
@@ -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()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user