Fix: Remove duplicate database refresh logic (Fabric). Add logging for collection fetching. (#2426)

* Remove duplicate database refresh logic. Add logging for collection fetching

* fix: Fix unit test

* fix: Update snapshots to include databasesRefreshed property

---------

Co-authored-by: Laurent Nguyen <languye@microsoft.com>
This commit is contained in:
Laurent Nguyen
2026-03-16 14:24:27 +01:00
committed by GitHub
parent c5d1f4f06f
commit 7a93df6a4b
7 changed files with 30 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
import { ContainerResponse } from "@azure/cosmos";
import { Queries } from "Common/Constants";
import * as Logger from "Common/Logger";
import { CosmosDbArtifactType } from "Contracts/FabricMessagesContract";
import { isFabric, isFabricMirroredKey } from "Platform/Fabric/FabricUtil";
import { AuthType } from "../../AuthType";
@@ -61,7 +62,14 @@ export async function readCollections(databaseId: string): Promise<DataModels.Co
return await readCollectionsWithARM(databaseId);
}
Logger.logInfo(`readCollections: calling fetchAll for database ${databaseId}`, "readCollections");
const fetchAllStart = Date.now();
const sdkResponse = await client().database(databaseId).containers.readAll().fetchAll();
Logger.logInfo(
`readCollections: fetchAll completed for database ${databaseId}, count=${sdkResponse.resources
?.length}, durationMs=${Date.now() - fetchAllStart}`,
"readCollections",
);
return sdkResponse.resources as DataModels.Collection[];
} catch (error) {
handleError(error, "ReadCollections", `Error while querying containers for database ${databaseId}`);