TSK-803: Fix load speed (#2728)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2023-03-13 23:50:10 +07:00
committed by GitHub
parent b6980f307e
commit 9eddd84ada
11 changed files with 111 additions and 21 deletions
+30 -3
View File
@@ -391,7 +391,7 @@ export interface FullTextSearchContext extends Class<Doc> {
fullTextSummary?: boolean
forceIndex?: boolean
// If defined, will propogate changes to childs with defined set of classes
// If defined, will propagate changes to child's with defined set of classes
propogate?: Ref<Class<Doc>>[]
}
@@ -401,7 +401,7 @@ export interface FullTextSearchContext extends Class<Doc> {
export interface ConfigurationElement extends Class<Doc> {
// Title will be presented to owner.
title: IntlString
// Group for groupping.
// Group for grouping.
group: IntlString
}
@@ -410,7 +410,7 @@ export interface ConfigurationElement extends Class<Doc> {
*
* Define configuration value configuration for workspace.
*
* Configuration is accessble only for owners of workspace and underhood services.
* Configuration is accessible only for owners of workspace and under hood services.
*/
export interface Configuration extends Doc {
enabled: boolean
@@ -420,3 +420,30 @@ export interface Configuration extends Doc {
* @public
*/
export type RelatedDocument = Pick<Doc, '_id' | '_class'>
/**
* @public
*/
export enum IndexOrder {
Ascending = 1,
Descending = -1
}
/**
* @public
*/
export type FieldIndex<T extends Doc> = {
[P in keyof T]?: IndexOrder
} & {
[key: string]: IndexOrder
}
/**
* @public
*
* Mixin for extra indexing fields.
*/
export interface IndexingConfiguration<T extends Doc> extends Class<Doc> {
// Define a list of extra index definitions.
indexes: (FieldIndex<T> | string)[]
}
+2 -1
View File
@@ -166,12 +166,13 @@ export async function createClient (
}
const conn = await connect(txHandler)
const t = Date.now()
const atxes = await conn.findAll(
core.class.Tx,
{ objectSpace: core.space.Model },
{ sort: { _id: SortingOrder.Ascending } }
)
console.log('find model', atxes.length)
console.log('find model', atxes.length, Date.now() - t)
let systemTx: Tx[] = []
const userTx: Tx[] = []
+4 -2
View File
@@ -42,7 +42,8 @@ import type {
UserStatus,
Configuration,
ConfigurationElement,
IndexStageState
IndexStageState,
IndexingConfiguration
} from './classes'
import type {
Tx,
@@ -109,7 +110,8 @@ export default plugin(coreId, {
},
mixin: {
FullTextSearchContext: '' as Ref<Mixin<FullTextSearchContext>>,
ConfigurationElement: '' as Ref<Mixin<ConfigurationElement>>
ConfigurationElement: '' as Ref<Mixin<ConfigurationElement>>,
IndexConfiguration: '' as Ref<Mixin<IndexingConfiguration<Doc>>>
},
space: {
Tx: '' as Ref<Space>,