mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-07-13 23:43:43 +01:00
Moved constants
This commit is contained in:
parent
f41de718a0
commit
9e8793d1b1
@ -437,8 +437,3 @@ export class TerminalQueryParams {
|
|||||||
public static readonly SubscriptionId = "subscriptionId";
|
public static readonly SubscriptionId = "subscriptionId";
|
||||||
public static readonly TerminalEndpoint = "terminalEndpoint";
|
public static readonly TerminalEndpoint = "terminalEndpoint";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LoadOfferRetry {
|
|
||||||
public static readonly MaxRetries = 5;
|
|
||||||
public static readonly RetryAfterMilliSeconds = 5000;
|
|
||||||
}
|
|
||||||
|
@ -41,8 +41,11 @@ import { userContext } from "../../UserContext";
|
|||||||
import TabsBase from "../Tabs/TabsBase";
|
import TabsBase from "../Tabs/TabsBase";
|
||||||
import { fetchPortalNotifications } from "../../Common/PortalNotifications";
|
import { fetchPortalNotifications } from "../../Common/PortalNotifications";
|
||||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||||
|
import promiseRetry from "p-retry";
|
||||||
|
|
||||||
export default class Collection implements ViewModels.Collection {
|
export default class Collection implements ViewModels.Collection {
|
||||||
|
private static readonly LoadOfferMaxRetries = 5;
|
||||||
|
private static readonly LoadOfferRetryAfterMilliSeconds = 5000;
|
||||||
public nodeKind: string;
|
public nodeKind: string;
|
||||||
public container: Explorer;
|
public container: Explorer;
|
||||||
public self: string;
|
public self: string;
|
||||||
@ -1333,11 +1336,11 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
|
|
||||||
public async loadAutopilotOfferWithRetry(): Promise<DataModels.Offer> {
|
public async loadAutopilotOfferWithRetry(): Promise<DataModels.Offer> {
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
while (retryCount < Constants.LoadOfferRetry.MaxRetries) {
|
while (retryCount < Collection.LoadOfferMaxRetries) {
|
||||||
if (this.offer().content.offerAutopilotSettings) {
|
if (this.offer().content.offerAutopilotSettings) {
|
||||||
return this.offer();
|
return this.offer();
|
||||||
} else {
|
} else {
|
||||||
await new Promise(resolve => setTimeout(resolve, Constants.LoadOfferRetry.RetryAfterMilliSeconds));
|
await new Promise(resolve => setTimeout(resolve, Collection.LoadOfferRetryAfterMilliSeconds));
|
||||||
await this.loadOffer();
|
await this.loadOffer();
|
||||||
}
|
}
|
||||||
retryCount++;
|
retryCount++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user