5x Fix cache performance issues (#6616)
Calling `getObjectMetadata` from `WorkspaceCacheStorageService` in every query was causing big performance issues. The `objectMetadataCollection` is now part of the `WorkspaceInternalContext` so we only instance it once in the `WorkspaceDatasourceFactory`. Queries are now much faster, for instance for TimelineCalendar, it went from ~450ms to 80ms.
This commit is contained in:
@ -63,21 +63,6 @@ export class WorkspaceCacheStorageService {
|
||||
);
|
||||
}
|
||||
|
||||
async getObjectMetadata(
|
||||
workspaceId: string,
|
||||
predicate: (objectMetadata: ObjectMetadataEntity) => boolean,
|
||||
): Promise<ObjectMetadataEntity | undefined> {
|
||||
const objectMetadataCollection = await this.workspaceSchemaCache.get<
|
||||
ObjectMetadataEntity[]
|
||||
>(`objectMetadataCollection:${workspaceId}`);
|
||||
|
||||
if (!objectMetadataCollection) {
|
||||
return;
|
||||
}
|
||||
|
||||
return objectMetadataCollection.find(predicate);
|
||||
}
|
||||
|
||||
setTypeDefs(workspaceId: string, typeDefs: string): Promise<void> {
|
||||
return this.workspaceSchemaCache.set<string>(
|
||||
`typeDefs:${workspaceId}`,
|
||||
|
||||
Reference in New Issue
Block a user