Improve performance twenty orm (#6691)
## Context As we grow, the messaging scripts are experiencing performance issues forcing us to temporarily disable them on the cloud. While investigating the performance, I have noticed that generating the entity schema (for twentyORM) in the repository is taking ~500ms locally on my Mac M2 so likely more on pods. Caching the entitySchema then! I'm also clarifying naming around schemaVersion and cacheVersions ==> both are renamed workspaceMetadataVersion and migrated to the workspace table (the workspaceCacheVersion table is dropped).
This commit is contained in:
@ -33,6 +33,8 @@ export class MessagingMessageListFetchCronJob {
|
||||
|
||||
@Process(MessagingMessageListFetchCronJob.name)
|
||||
async handle(): Promise<void> {
|
||||
console.time('MessagingMessageListFetchCronJob time');
|
||||
|
||||
const activeWorkspaces = await this.workspaceRepository.find({
|
||||
where: {
|
||||
activationStatus: WorkspaceActivationStatus.ACTIVE,
|
||||
@ -66,5 +68,7 @@ export class MessagingMessageListFetchCronJob {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.timeEnd('MessagingMessageListFetchCronJob time');
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ export class MessagingMessagesImportCronJob {
|
||||
|
||||
@Process(MessagingMessagesImportCronJob.name)
|
||||
async handle(): Promise<void> {
|
||||
console.time('MessagingMessagesImportCronJob time');
|
||||
const activeWorkspaces = await this.workspaceRepository.find({
|
||||
where: {
|
||||
activationStatus: WorkspaceActivationStatus.ACTIVE,
|
||||
@ -69,5 +70,7 @@ export class MessagingMessagesImportCronJob {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.timeEnd('MessagingMessagesImportCronJob time');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user