Skip to content

Commit

Permalink
Merge 9522 9513 (#8103)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Bykhov <[email protected]>
Signed-off-by: Alexander Onnikov <[email protected]>
Signed-off-by: Victor Ilyushchenko <[email protected]>
Signed-off-by: Andrey Sobolev <[email protected]>
Co-authored-by: Denis Bykhov <[email protected]>
Co-authored-by: Alexander Onnikov <[email protected]>
Co-authored-by: Victor Ilyushchenko <[email protected]>
  • Loading branch information
4 people authored Feb 27, 2025
1 parent 9eba1cd commit 05f1d83
Show file tree
Hide file tree
Showing 97 changed files with 1,741 additions and 710 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ jobs:
cd ./ws-tests
export DO_CLEAN=true
./prepare.sh
- name: Run API tests
run: |
cd ./ws-tests/api-tests
node ../../common/scripts/install-run-rush.js validate --to @hcengineering/api-tests
node ../../common/scripts/install-run-rushx.js api-test --verbose
- name: Install Playwright
run: |
cd ./ws-tests/sanity
Expand Down
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
"args": ["src/__start.ts"],
"env": {
"FULLTEXT_URL": "http://localhost:4710",
// "DB_URL": "mongodb://localhost:27018",
"DB_URL": "mongodb://localhost:27018",
// "DB_URL": "postgresql://postgres:example@localhost:5432",
"DB_URL": "postgresql://[email protected]:26258/defaultdb?sslmode=disable",
// "DB_URL": "postgresql://[email protected]:26258/defaultdb?sslmode=disable",
// "GREEN_URL": "http://huly.local:6767?token=secret",
"SERVER_PORT": "3335",
"SERVER_PORT": "3334",
"METRICS_CONSOLE": "false",
"METRICS_FILE": "${workspaceRoot}/metrics.txt", // Show metrics in console evert 30 seconds.,
"STORAGE_CONFIG": "minio|localhost?accessKey=minioadmin&secretKey=minioadmin",
Expand Down
63 changes: 53 additions & 10 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 67 additions & 36 deletions dev/tool/src/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ export async function benchmark (
}
}
})
worker.on('error', (err) => {
console.error('worker error', err)
})
})

const m = newMetrics()
Expand All @@ -150,6 +153,9 @@ export async function benchmark (
moment: number
mem: number
memTotal: number
memRSS: number
memFree: number
memArrays: number
cpu: number
requestTime: number
operations: number
Expand All @@ -161,6 +167,9 @@ export async function benchmark (
moment: 'Moment Time',
mem: 'Mem',
memTotal: 'Mem total',
memRSS: 'Mem RSS',
memFree: 'Mem Free',
memArrays: 'Mem Arrays',
cpu: 'CPU',
requestTime: 'Request time',
operations: 'OPS',
Expand All @@ -173,6 +182,9 @@ export async function benchmark (
let cpu: number = 0
let memUsed: number = 0
let memTotal: number = 0
let memRSS: number = 0
const memFree: number = 0
let memArrays: number = 0
let elapsed = 0
let requestTime: number = 0
let operations = 0
Expand Down Expand Up @@ -207,54 +219,68 @@ export async function benchmark (
}
}
if (!found) {
console.log('no measurements found for path', path, p)
return null
}
}
return m
}

let timer: any
let p: Promise<void> | undefined
if (isMainThread && monitorConnection !== undefined) {
timer = setInterval(() => {
const st = platformNow()

try {
const fetchUrl = endpoint.replace('ws:/', 'http:/') + '/api/v1/statistics?token=' + token
void fetch(fetchUrl)
.then((res) => {
void res
.json()
.then((json) => {
memUsed = json.statistics.memoryUsed
memTotal = json.statistics.memoryTotal
cpu = json.statistics.cpuUsage
// operations = 0
requestTime = 0
// transfer = 0
const r = extract(
json.metrics as Metrics,
'🧲 session',
'client',
'handleRequest',
'process',
'find-all'
)
operations = (r?.operations ?? 0) - oldOperations
oldOperations = r?.operations ?? 0

requestTime = (r?.value ?? 0) / (((r?.operations as number) ?? 0) + 1)

const tr = extract(json.metrics as Metrics, '🧲 session', '#send-data')
transfer = (tr?.value ?? 0) - oldTransfer
oldTransfer = tr?.value ?? 0
})
.catch((err) => {
console.log(err)
})
})
.catch((err) => {
console.log(err)
const fetchUrl = endpoint.replace('ws:/', 'http:/') + '/api/v1/statistics'
if (p === undefined) {
p = fetch(fetchUrl, {
headers: {
Authorization: 'Bearer ' + token
},
keepalive: true
})
.then((res) => {
void res
.json()
.then((json) => {
memUsed = json.statistics.memoryUsed
memTotal = json.statistics.memoryTotal
memRSS = json.statistics.memoryRSS
memArrays = json.statistics.memoryArrayBuffers
cpu = json.statistics.cpuUsage
// operations = 0
requestTime = 0
// transfer = 0
const r = extract(
json.metrics as Metrics,
'🧲 session',
'client',
'handleRequest',
'process',
'find-all'
)
operations = (r?.operations ?? 0) - oldOperations
oldOperations = r?.operations ?? 0

requestTime = (r?.value ?? 0) / (((r?.operations as number) ?? 0) + 1)

const tr = extract(json.metrics as Metrics, '🧲 session', 'client', '#send-data')
transfer = (tr?.value ?? 0) - oldTransfer
oldTransfer = tr?.value ?? 0
p = undefined
})
.catch((err) => {
console.log(err)
p = undefined
})
})
.catch((err) => {
console.log(err)
p = undefined
})
}
} catch (err) {
console.log(err)
}
Expand Down Expand Up @@ -288,7 +314,10 @@ export async function benchmark (
moment,
average: Math.round(opTime / (ops + 1)),
mem: memUsed,
memRSS,
memTotal,
memFree,
memArrays,
cpu,
requestTime,
operations,
Expand Down Expand Up @@ -363,7 +392,9 @@ export function benchmarkWorker (): void {
if (!isMainThread) {
parentPort?.on('message', (msg: StartMessage) => {
console.log('starting worker', msg.workId)
void perform(msg)
void perform(msg).catch((err) => {
console.error('failed to perform', err)
})
})
}

Expand Down
16 changes: 12 additions & 4 deletions models/controlled-documents/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ export function createModel (builder: Builder): void {
titleProvider: documents.function.ControlledDocumentTitleProvider
})

builder.mixin(documents.class.DocumentMeta, core.class.Class, view.mixin.ObjectTitle, {
titleProvider: documents.function.ControlledDocumentTitleProvider
})

builder.mixin(documents.class.DocumentApprovalRequest, core.class.Class, view.mixin.ObjectPresenter, {
presenter: documents.component.DocumentApprovalRequestPresenter
})
Expand Down Expand Up @@ -406,6 +402,10 @@ export function createModel (builder: Builder): void {
presenter: documents.component.DocumentPresenter
})

builder.mixin(documents.class.ControlledDocument, core.class.Class, view.mixin.LinkProvider, {
encode: documents.function.GetControlledDocumentLinkFragment
})

builder.mixin(documents.class.Document, core.class.Class, view.mixin.IgnoreActions, {
actions: [view.action.Delete]
})
Expand Down Expand Up @@ -741,6 +741,14 @@ export function createModel (builder: Builder): void {
provider: documents.function.DocumentIdentifierProvider
})

builder.mixin(documents.class.ControlledDocument, core.class.Class, view.mixin.ReferenceObjectProvider, {
provider: documents.function.ControlledDocumentReferenceObjectProvider
})

builder.mixin(documents.class.ProjectDocument, core.class.Class, view.mixin.ReferenceObjectProvider, {
provider: documents.function.ProjectDocumentReferenceObjectProvider
})

createAction(
builder,
{
Expand Down
Loading

0 comments on commit 05f1d83

Please sign in to comment.