Skip to content

Commit

Permalink
UBERF-6374: Improve server logging and improve startup performance (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
haiodo authored and Nima committed Apr 9, 2024
1 parent 13a33e1 commit e435238
Show file tree
Hide file tree
Showing 39 changed files with 632 additions and 406 deletions.
6 changes: 0 additions & 6 deletions dev/storage/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ class InMemoryTxAdapter extends DummyDbAdapter implements TxAdapter {
return r
}

async init (model: Tx[]): Promise<void> {
for (const tx of model) {
await this.txdb.tx(tx)
}
}

async getModel (): Promise<Tx[]> {
return builder().getTxes()
}
Expand Down
2 changes: 1 addition & 1 deletion models/activity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class TReaction extends TAttachedDoc implements Reaction {
@Index(IndexKind.Indexed)
declare attachedTo: Ref<ActivityMessage>

@Prop(TypeRef(activity.class.ActivityMessage), core.string.AttachedToClass)
@Prop(TypeRef(core.class.Class), core.string.AttachedToClass)
@Index(IndexKind.Indexed)
declare attachedToClass: Ref<Class<ActivityMessage>>

Expand Down
5 changes: 3 additions & 2 deletions models/hr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ import {
} from '@hcengineering/model'
import attachment from '@hcengineering/model-attachment'
import calendar from '@hcengineering/model-calendar'
import chunter from '@hcengineering/model-chunter'
import contact, { TEmployee, TPersonAccount } from '@hcengineering/model-contact'
import core, { TAttachedDoc, TDoc, TSpace, TType } from '@hcengineering/model-core'
import view, { classPresenter, createAction } from '@hcengineering/model-view'
import workbench from '@hcengineering/model-workbench'
import notification from '@hcengineering/notification'
import { type Asset, type IntlString } from '@hcengineering/platform'
import hr from './plugin'
import { PaletteColorIndexes } from '@hcengineering/ui/src/colors'
import chunter from '@hcengineering/model-chunter'
import hr from './plugin'

export { hrId } from '@hcengineering/hr'
export { hrOperation } from './migration'
Expand Down Expand Up @@ -147,6 +147,7 @@ export class TRequest extends TAttachedDoc implements Request {
@Index(IndexKind.Indexed)
declare attachedTo: Ref<Staff>

@Prop(TypeRef(core.class.Class), core.string.Class)
@Index(IndexKind.Indexed)
declare attachedToClass: Ref<Class<Staff>>

Expand Down
5 changes: 4 additions & 1 deletion models/notification/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import {
notificationId,
type MentionInboxNotification
} from '@hcengineering/notification'
import { type Asset, type IntlString } from '@hcengineering/platform'
import { getEmbeddedLabel, type Asset, type IntlString } from '@hcengineering/platform'
import setting from '@hcengineering/setting'
import { type AnyComponent } from '@hcengineering/ui/src/types'

Expand Down Expand Up @@ -178,12 +178,15 @@ export class TNotificationContextPresenter extends TClass implements Notificatio

@Model(notification.class.DocUpdates, core.class.Doc, DOMAIN_NOTIFICATION)
export class TDocUpdates extends TDoc implements DocUpdates {
@Prop(TypeRef(core.class.Account), core.string.Account)
@Index(IndexKind.Indexed)
user!: Ref<Account>

@Prop(TypeRef(core.class.Account), core.string.AttachedTo)
@Index(IndexKind.Indexed)
attachedTo!: Ref<Doc>

@Prop(TypeRef(core.class.Account), getEmbeddedLabel('Hidden'))
@Index(IndexKind.Indexed)
hidden!: boolean

Expand Down
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
},
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"just-clone": "~6.2.0",
"fast-equals": "^2.0.3"
},
"repository": "https://github.com/hcengineering/anticrm",
Expand Down
13 changes: 7 additions & 6 deletions packages/core/src/__tests__/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type { DocumentQuery, FindResult, TxResult, SearchQuery, SearchOptions, S
import { Tx, TxFactory, TxProcessor } from '../tx'
import { connect } from './connection'
import { genMinModel } from './minmodel'
import { clone } from '../clone'

describe('client', () => {
it('should create client and spaces', async () => {
Expand Down Expand Up @@ -118,7 +119,7 @@ describe('client', () => {
loadDocs: async (domain: Domain, docs: Ref<Doc>[]) => [],
upload: async (domain: Domain, docs: Doc[]) => {},
clean: async (domain: Domain, docs: Ref<Doc>[]) => {},
loadModel: async (last: Timestamp) => txes,
loadModel: async (last: Timestamp) => clone(txes),
getAccount: async () => null as unknown as Account,
measure: async () => {
return async () => ({ time: 0, serverTime: 0 })
Expand All @@ -141,8 +142,8 @@ describe('client', () => {

expect(result1).toHaveLength(1)
expect(result1[0]._id).toStrictEqual(txCreateDoc1.objectId)
expect(spyCreate).toHaveBeenLastCalledWith(txCreateDoc1)
expect(spyUpdate).toBeCalledTimes(0)
expect(spyCreate).toHaveBeenLastCalledWith(txCreateDoc1, false)
expect(spyUpdate).toHaveBeenCalledTimes(0)
await client1.close()

const pluginData2 = {
Expand All @@ -159,8 +160,8 @@ describe('client', () => {
expect(result2).toHaveLength(2)
expect(result2[0]._id).toStrictEqual(txCreateDoc1.objectId)
expect(result2[1]._id).toStrictEqual(txCreateDoc2.objectId)
expect(spyCreate).toHaveBeenLastCalledWith(txCreateDoc2)
expect(spyUpdate).toBeCalledTimes(0)
expect(spyCreate).toHaveBeenLastCalledWith(txCreateDoc2, false)
expect(spyUpdate).toHaveBeenCalledTimes(0)
await client2.close()

const pluginData3 = {
Expand All @@ -181,7 +182,7 @@ describe('client', () => {

expect(result3).toHaveLength(1)
expect(result3[0]._id).toStrictEqual(txCreateDoc2.objectId)
expect(spyCreate).toHaveBeenLastCalledWith(txCreateDoc2)
expect(spyCreate).toHaveBeenLastCalledWith(txCreateDoc2, false)
expect(spyUpdate.mock.calls[1][1]).toStrictEqual(txUpdateDoc)
expect(spyUpdate).toBeCalledTimes(2)
await client3.close()
Expand Down
Loading

0 comments on commit e435238

Please sign in to comment.