mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 17:30:46 +00:00
Upgrade Cosmos SDK to v4.3 (#2137)
* Upgrade Cosmos SDK to v4.3 * push pkg lock * fix tests * fix package-lock.json * fix package-lock * fix package-lock.json * fix package-lock.json * log console warning when RU limit is reached * fix tests * fix format * fix tests * added description to RU limit message * show warning icon on tab header --------- Co-authored-by: Asier Isayas <aisayas@microsoft.com>
This commit is contained in:
@@ -23,3 +23,7 @@ export const logConsoleError = (msg: string): void => {
|
||||
export const logConsoleInfo = (msg: string): void => {
|
||||
log(ConsoleDataType.Info, msg);
|
||||
};
|
||||
|
||||
export const logConsoleWarning = (msg: string): void => {
|
||||
log(ConsoleDataType.Warning, msg);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { PartitionKey, PartitionKeyDefinition } from "@azure/cosmos";
|
||||
import { getRUThreshold, ruThresholdEnabled } from "Shared/StorageUtility";
|
||||
import { userContext } from "UserContext";
|
||||
import { logConsoleWarning } from "Utils/NotificationConsoleUtils";
|
||||
import * as DataModels from "../Contracts/DataModels";
|
||||
import * as ViewModels from "../Contracts/ViewModels";
|
||||
|
||||
@@ -86,6 +89,18 @@ 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) {
|
||||
logConsoleWarning(
|
||||
`Warning: Query has exceeded the Request Unit threshold of ${ruThreshold} RUs. Query results show only those documents returned before the threshold was exceeded`,
|
||||
);
|
||||
results.ruThresholdExceeded = true;
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
const resultsMetadata = {
|
||||
hasMoreResults: results.hasMoreResults,
|
||||
itemCount: results.itemCount,
|
||||
|
||||
Reference in New Issue
Block a user