mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-09 11:17:43 +02:00
UBERF-4319: Performance changes (#4474)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -38,7 +38,8 @@ import core, {
|
||||
generateId,
|
||||
SearchQuery,
|
||||
SearchOptions,
|
||||
SearchResult
|
||||
SearchResult,
|
||||
MeasureDoneOperation
|
||||
} from '@hcengineering/core'
|
||||
import { PlatformError, UNAUTHORIZED, broadcastEvent, getMetadata, unknownError } from '@hcengineering/platform'
|
||||
|
||||
@@ -376,6 +377,27 @@ class Connection implements ClientConnection {
|
||||
return await promise.promise
|
||||
}
|
||||
|
||||
async measure (operationName: string): Promise<MeasureDoneOperation> {
|
||||
const dateNow = Date.now()
|
||||
|
||||
// Send measure-start
|
||||
const mid = await this.sendRequest({
|
||||
method: 'measure',
|
||||
params: [operationName]
|
||||
})
|
||||
return async () => {
|
||||
const serverTime: number = await this.sendRequest({
|
||||
method: 'measure-done',
|
||||
params: [operationName, mid]
|
||||
})
|
||||
|
||||
return {
|
||||
time: Date.now() - dateNow,
|
||||
serverTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async loadModel (last: Timestamp, hash?: string): Promise<Tx[] | LoadModelResponse> {
|
||||
return await this.sendRequest({ method: 'loadModel', params: [last, hash] })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user