Add fail on metadata cache miss (#7118)

- avoid failing when missing cache (used for command)
- remove unused load cache function. Cache will be always re-created
when trying to fetch if not existing
This commit is contained in:
Thomas Trompette
2024-09-18 15:40:24 +02:00
committed by GitHub
parent 44587b4908
commit 741a969cc1
5 changed files with 92 additions and 74 deletions

View File

@ -26,10 +26,13 @@ export class WorkspaceMetadataCacheService {
) {}
@LogExecutionTime()
async recomputeMetadataCache(
workspaceId: string,
force = false,
): Promise<void> {
async recomputeMetadataCache({
workspaceId,
ignoreLock = false,
}: {
workspaceId: string;
ignoreLock?: boolean;
}): Promise<void> {
const currentCacheVersion =
await this.getMetadataVersionFromCache(workspaceId);
@ -43,17 +46,13 @@ export class WorkspaceMetadataCacheService {
);
}
if (!force && currentCacheVersion === currentDatabaseVersion) {
return;
}
const isAlreadyCaching =
await this.workspaceCacheStorageService.getObjectMetadataOngoingCachingLock(
workspaceId,
currentDatabaseVersion,
);
if (isAlreadyCaching) {
if (!ignoreLock && isAlreadyCaching) {
return;
}