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:
+5
-9
@@ -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',
|
||||
]),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user