Upgrade Cosmos SDK to v4.3

This commit is contained in:
Asier Isayas
2025-05-09 13:43:55 -04:00
parent 2f858ecf9b
commit 2a34e96fca
9 changed files with 64 additions and 43 deletions

View File

@@ -1,4 +1,7 @@
import { PartitionKey, PartitionKeyDefinition } from "@azure/cosmos";
import { getRUThreshold, ruThresholdEnabled } from "Shared/StorageUtility";
import { userContext } from "UserContext";
import { logConsoleError } from "Utils/NotificationConsoleUtils";
import * as DataModels from "../Contracts/DataModels";
import * as ViewModels from "../Contracts/ViewModels";
@@ -86,6 +89,15 @@ export const queryPagesUntilContentPresent = async (
results.roundTrips = roundTrips;
results.requestCharge = Number(results.requestCharge) + netRequestCharge;
netRequestCharge = Number(results.requestCharge);
if (results.hasMoreResults && userContext.apiType === "SQL" && ruThresholdEnabled()) {
const ruThreshold: number = getRUThreshold();
if (netRequestCharge > ruThreshold) {
logConsoleError(`Request discontinued after exceeding the Request Unit threshold of ${ruThreshold}.`);
return results;
}
}
const resultsMetadata = {
hasMoreResults: results.hasMoreResults,
itemCount: results.itemCount,