fix: invalidate cache when no record inside workspace cache version (#3994)
* fix: invalidate cache when no record inside workspace cache version * fix: use getVersion
This commit is contained in:
@ -28,13 +28,17 @@ export class WorkspaceSchemaStorageService {
|
||||
(await this.cacheVersionMemoryStorageService.read({
|
||||
key: workspaceId,
|
||||
})) ?? '0';
|
||||
const latestVersion =
|
||||
let latestVersion =
|
||||
await this.workspaceCacheVersionService.getVersion(workspaceId);
|
||||
|
||||
if (currentVersion !== latestVersion) {
|
||||
if (!latestVersion || currentVersion !== latestVersion) {
|
||||
// Invalidate cache if version mismatch is detected
|
||||
await this.invalidateCache(workspaceId);
|
||||
|
||||
// If the latest version is not found, increment the version
|
||||
latestVersion ??=
|
||||
await this.workspaceCacheVersionService.incrementVersion(workspaceId);
|
||||
|
||||
// Update the cache version after invalidation
|
||||
await this.cacheVersionMemoryStorageService.write({
|
||||
key: workspaceId,
|
||||
|
||||
Reference in New Issue
Block a user