Improve performances (#14869)

## Improvements

- Add logs to all gql operations and rest calls to help debug CPU issues
on the backend. These are temporary and should be removed
- Remove nested relations from workflowVersions load (used to add manual
triggers in the side bar). On some workspaces this call result in a
response of 4MB which is heavy on CPU
- Investigated Redis Usage ==> made a few improvements, we are should
still migrate to the new cache service once available
- investigated db calls in messaging / calendar fetch list + workflow
enqueue run cron jobs. Everything seems to be properly batched
This commit is contained in:
Charles Bochet
2025-10-03 17:22:03 +02:00
committed by GitHub
parent f973a1bcdb
commit c5cdf45f85
19 changed files with 308 additions and 199 deletions
@@ -43,14 +43,20 @@ export function useCachedMetadata(config: CacheMetadataPluginConfig): Plugin {
return {
onRequest: async ({ endResponse, serverContext }) => {
// TODO: we should probably override the graphql-yoga request type to include the workspace and locale
const request = (serverContext as unknown as { req: Request }).req;
if (!request.workspace?.id) {
return;
}
if (!config.operationsToCache.includes(getOperationName(serverContext))) {
return;
}
const cacheKey = computeCacheKey({
operationName: getOperationName(serverContext),
// TODO: we should probably override the graphql-yoga request type to include the workspace and locale
request: (serverContext as unknown as { req: Request }).req,
request,
});
const cachedResponse = await config.cacheGetter(cacheKey);
@@ -61,13 +67,19 @@ export function useCachedMetadata(config: CacheMetadataPluginConfig): Plugin {
}
},
onResponse: async ({ response, serverContext }) => {
const request = (serverContext as unknown as { req: Request }).req;
if (!request.workspace?.id) {
return;
}
if (!config.operationsToCache.includes(getOperationName(serverContext))) {
return;
}
const cacheKey = computeCacheKey({
operationName: getOperationName(serverContext),
request: (serverContext as unknown as { req: Request }).req,
request,
});
const cachedResponse = await config.cacheGetter(cacheKey);