From 8368dd41c4f93fe413e1ddac868be87ea18f3b56 Mon Sep 17 00:00:00 2001 From: Weiko Date: Thu, 23 Jul 2026 14:28:07 +0200 Subject: [PATCH] Remove legacy FindAllViews response cache flush from migration runner (#23190) The pattern-flush (a full Redis keyspace SCAN) was kept for exactly one release after the metadata GraphQL caches were re-keyed on flat-map hashes (#23164), as the only invalidation signal for old pods' version-keyed FindAllViews entries during rolling deploys. With all pods on hash-keyed caches, dependency-hash rotation in the cache key covers both view and metadata changes, so the flush is redundant. flushGraphQLOperation has no remaining callers, so it is deleted from WorkspaceCacheStorageService as well. incrementMetadataVersion stays: it still feeds the X-Schema-Version check. Review in cubic --- .../workspace-cache-storage.service.ts | 12 --------- .../workspace-migration-runner.service.ts | 25 ------------------- 2 files changed, 37 deletions(-) diff --git a/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts b/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts index 159c389286..f6a322d306 100644 --- a/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts +++ b/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts @@ -154,18 +154,6 @@ export class WorkspaceCacheStorageService { ); } - async flushGraphQLOperation({ - operationName, - workspaceId, - }: { - operationName: string; - workspaceId: string; - }): Promise { - await this.cacheStorageService.flushByPattern( - `${WORKSPACE_CACHE_KEYS.GraphQLOperations}:${operationName}:${workspaceId}:*`, - ); - } - async flushHashKeyedWorkspaceCache(workspaceId: string): Promise { await Promise.all( Object.values(HASH_KEYED_WORKSPACE_CACHE_KEYS).map((key) => diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/services/workspace-migration-runner.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/services/workspace-migration-runner.service.ts index 203f534365..7434cbb771 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/services/workspace-migration-runner.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/services/workspace-migration-runner.service.ts @@ -15,9 +15,7 @@ import { getMetadataRelatedMetadataNamesForValidation } from 'src/engine/metadat import { getMetadataRelatedMetadataNames } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-related-metadata-names.util'; import { getMetadataSerializedRelationNames } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-serialized-relation-names.util'; import { createSearchFieldMetadatasByTsVectorFieldIdAccessor } from 'src/engine/metadata-modules/flat-search-field-metadata/utils/create-search-field-metadatas-by-ts-vector-field-id-accessor.util'; -import { FIND_ALL_VIEWS_GRAPHQL_OPERATION } from 'src/engine/metadata-modules/view/constants/find-all-views-graphql-operation.constant'; import { WorkspaceMetadataVersionService } from 'src/engine/metadata-modules/workspace-metadata-version/services/workspace-metadata-version.service'; -import { WorkspaceCacheStorageService } from 'src/engine/workspace-cache-storage/workspace-cache-storage.service'; import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service'; import { WorkspaceMigration } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration.type'; import { @@ -37,7 +35,6 @@ export class WorkspaceMigrationRunnerService { private readonly coreDataSource: DataSource, private readonly workspaceMigrationRunnerActionHandlerRegistry: WorkspaceMigrationRunnerActionHandlerRegistryService, private readonly workspaceMetadataVersionService: WorkspaceMetadataVersionService, - private readonly workspaceCacheStorageService: WorkspaceCacheStorageService, private readonly workspaceCacheService: WorkspaceCacheService, private readonly logger: LoggerService, private readonly twentyConfigService: TwentyConfigService, @@ -65,28 +62,6 @@ export class WorkspaceMigrationRunnerService { ); } - const viewRelatedFlatMapsKeys: (keyof AllFlatEntityMaps)[] = [ - 'flatViewMaps', - 'flatViewFilterMaps', - 'flatViewGroupMaps', - 'flatViewFieldMaps', - 'flatViewFilterGroupMaps', - ]; - const shouldInvalidateFindViewsGraphqlCacheOperation = - viewRelatedFlatMapsKeys.some((key) => flatMapsKeysSet.has(key)); - - if ( - shouldInvalidateFindViewsGraphqlCacheOperation || - shouldIncrementMetadataGraphqlSchemaVersion - ) { - asyncOperations.push( - this.workspaceCacheStorageService.flushGraphQLOperation({ - operationName: FIND_ALL_VIEWS_GRAPHQL_OPERATION, - workspaceId, - }), - ); - } - const shouldInvalidateRoleMapCache = flatMapsKeysSet.has('flatRoleMaps') || flatMapsKeysSet.has('flatRoleTargetMaps');