Skip to content

Commit

Permalink
UBERF-6042: Fix front service (#4991)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo authored Mar 15, 2024
1 parent 7d1508b commit 487d753
Show file tree
Hide file tree
Showing 7 changed files with 517 additions and 534 deletions.
664 changes: 242 additions & 422 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/text-editor/src/provider/minio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface EVENTS {
}

async function fetchContent (doc: YDoc, name: string): Promise<void> {
for (let i = 0; i < 5; i++) {
for (let i = 0; i < 2; i++) {
try {
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin

Expand All @@ -41,7 +41,7 @@ async function fetchContent (doc: YDoc, name: string): Promise<void> {
console.error(err)
}
// White a while
await new Promise((resolve) => setTimeout(resolve, 50))
await new Promise((resolve) => setTimeout(resolve, 10))
}
}

Expand Down
25 changes: 23 additions & 2 deletions plugins/workbench-resources/src/components/ServerManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import Expandable from '@hcengineering/ui/src/components/Expandable.svelte'
import { ObjectPresenter } from '@hcengineering/view-resources'
import { onDestroy } from 'svelte'
import MetricsInfo from './statistics/MetricsInfo.svelte'
import { workspacesStore } from '../utils'
import MetricsInfo from './statistics/MetricsInfo.svelte'
const _endpoint: string = fetchMetadataLocalStorage(login.metadata.LoginEndpoint) ?? ''
const token: string = getMetadata(presentation.metadata.Token) ?? ''
Expand All @@ -30,6 +30,7 @@
}
let data: any
let dataFront: any
let admin = false
onDestroy(
ticker.subscribe(() => {
Expand All @@ -41,6 +42,14 @@
.catch((err) => {
console.error(err)
})
void fetch(`/api/v1/statistics?token=${token}`, {})
.then(async (json) => {
dataFront = await json.json()
})
.catch((err) => {
console.error(err)
})
})
)
const tabs: TabItem[] = [
Expand All @@ -50,7 +59,11 @@
},
{
id: 'statistics',
labelIntl: getEmbeddedLabel('Statistics')
labelIntl: getEmbeddedLabel('Server')
},
{
id: 'statistics-front',
labelIntl: getEmbeddedLabel('Front')
},
{
id: 'users',
Expand Down Expand Up @@ -91,6 +104,8 @@
$: metricsData = data?.metrics as Metrics | undefined
$: metricsDataFront = dataFront?.metrics as Metrics | undefined
$: totalStats = Array.from(Object.entries(activeSessions).values()).reduce(
(cur, it) => {
const totalFind = it[1].reduce((it, itm) => itm.current.find + it, 0)
Expand Down Expand Up @@ -240,6 +255,12 @@
<MetricsInfo metrics={metricsData} />
{/if}
</div>
{:else if selectedTab === 'statistics-front'}
<div class="flex-column p-3 h-full" style:overflow="auto">
{#if metricsDataFront !== undefined}
<MetricsInfo metrics={metricsDataFront} />
{/if}
</div>
{/if}
{:else}
<Loading />
Expand Down
3 changes: 1 addition & 2 deletions server/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@types/body-parser": "~1.19.2",
"cross-env": "~7.0.3",
"ts-node": "^10.8.0",
"@types/compression": "~1.7.2",
"@types/sharp": "~0.32.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
Expand All @@ -47,14 +46,14 @@
"@hcengineering/platform": "^0.6.9",
"express": "^4.18.3",
"express-fileupload": "^1.4.3",
"express-static-gzip": "^2.1.7",
"uuid": "^8.3.2",
"cors": "^2.8.5",
"@hcengineering/elastic": "^0.6.0",
"@hcengineering/server-core": "^0.6.1",
"@hcengineering/server-token": "^0.6.7",
"@hcengineering/attachment": "^0.6.9",
"body-parser": "^1.20.2",
"compression": "~1.7.4",
"sharp": "~0.32.0",
"@hcengineering/minio": "^0.6.0",
"morgan": "^1.10.0"
Expand Down
6 changes: 5 additions & 1 deletion server/front/src/__start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
// limitations under the License.
//

import { MeasureMetricsContext, newMetrics } from '@hcengineering/core'
import { startFront } from './starter'
startFront()

const metricsContext = new MeasureMetricsContext('front', {}, {}, newMetrics())

startFront(metricsContext)
Loading

0 comments on commit 487d753

Please sign in to comment.