Uncached workspace entity DB lookup causes 2.7s auth overhead per request

https://sonarly.com/issue/3773?type=bug

The JWT auth strategy loads the WorkspaceEntity from the database on every authenticated request without caching, causing a 2774ms primary key lookup on this resource-constrained self-hosted instance and resulting in 3.5s total response time for a simple aggregate query.
This commit is contained in:
Sonarly Claude Code
2026-03-05 08:37:06 +00:00
parent 6486a3ce25
commit 3874b58d53
@@ -85,21 +85,17 @@ export class WorkspaceMigrationRunnerService {
flatMapsKeysSet.has('flatRoleMaps') ||
flatMapsKeysSet.has('flatRoleTargetMaps');
if (shouldIncrementMetadataGraphqlSchemaVersion) {
asyncOperations.push(
this.workspaceCacheService.invalidateAndRecompute(workspaceId, [
'ORMEntityMetadatas',
]),
);
}
if (shouldInvalidateRoleMapCache) {
if (
shouldIncrementMetadataGraphqlSchemaVersion ||
shouldInvalidateRoleMapCache
) {
asyncOperations.push(
this.workspaceCacheService.invalidateAndRecompute(workspaceId, [
'rolesPermissions',
'userWorkspaceRoleMap',
'flatRoleTargetMaps',
'apiKeyRoleMap',
'ORMEntityMetadatas',
'flatRoleTargetByAgentIdMaps',
]),
);