@microsoft/vscode-azext-azureauth 6.0.0-alpha.6 → 6.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -51,7 +51,7 @@ const Limiter_1 = require("../utils/Limiter");
|
|
|
51
51
|
const NotSignedInError_1 = require("../utils/NotSignedInError");
|
|
52
52
|
const screen_1 = require("../utils/screen");
|
|
53
53
|
const tryGetTokenExpiration_1 = require("../utils/tryGetTokenExpiration");
|
|
54
|
-
const EventDebounce =
|
|
54
|
+
const EventDebounce = 2 * 1000; // 2 seconds minimum between `onRefreshSuggested` events
|
|
55
55
|
const EventSilenceTime = 5 * 1000; // 5 seconds after sign-in to silence `onRefreshSuggested` events
|
|
56
56
|
const TenantListConcurrency = 3; // We will try to list tenants for at most 3 accounts in parallel
|
|
57
57
|
const SubscriptionListConcurrency = 5; // We will try to list subscriptions for at most 5 account+tenants in parallel
|
|
@@ -94,7 +94,11 @@ class AzureSubscriptionProviderBase {
|
|
|
94
94
|
return this.refreshSuggestedEmitter.event(callback, thisArg, disposables);
|
|
95
95
|
}
|
|
96
96
|
fireRefreshSuggestedIfNeeded(evtArgs) {
|
|
97
|
-
|
|
97
|
+
// subscriptionFilterChange is an explicit user action and must never be suppressed,
|
|
98
|
+
// otherwise re-selecting a subscription shortly after unselecting one gets swallowed
|
|
99
|
+
// by the debounce/silence window that the first refresh triggered.
|
|
100
|
+
if (evtArgs.reason !== 'subscriptionFilterChange' &&
|
|
101
|
+
(this.suppressRefreshSuggestedEvents || Date.now() < this.lastRefreshSuggestedTime + EventDebounce)) {
|
|
98
102
|
// Suppress and/or debounce events to avoid flooding
|
|
99
103
|
return false;
|
|
100
104
|
}
|
|
@@ -10,7 +10,7 @@ export interface AzureSubscriptionProvider {
|
|
|
10
10
|
/**
|
|
11
11
|
* Fires when the list of available subscriptions may have changed, and a refresh is suggested.
|
|
12
12
|
* The callback will be given a {@link RefreshSuggestedEvent} with more information.
|
|
13
|
-
* @note This will be fired at most every
|
|
13
|
+
* @note This will be fired at most every 2 seconds, to avoid flooding. It is also suppressed
|
|
14
14
|
* during operations this provider is performing itself, such as during sign-in.
|
|
15
15
|
*/
|
|
16
16
|
onRefreshSuggested: vscode.Event<RefreshSuggestedEvent>;
|
|
@@ -15,7 +15,7 @@ import { Limiter } from '../utils/Limiter';
|
|
|
15
15
|
import { isNotSignedInError, NotSignedInError } from '../utils/NotSignedInError';
|
|
16
16
|
import { screen } from '../utils/screen';
|
|
17
17
|
import { tryGetTokenExpiration } from '../utils/tryGetTokenExpiration';
|
|
18
|
-
const EventDebounce =
|
|
18
|
+
const EventDebounce = 2 * 1000; // 2 seconds minimum between `onRefreshSuggested` events
|
|
19
19
|
const EventSilenceTime = 5 * 1000; // 5 seconds after sign-in to silence `onRefreshSuggested` events
|
|
20
20
|
const TenantListConcurrency = 3; // We will try to list tenants for at most 3 accounts in parallel
|
|
21
21
|
const SubscriptionListConcurrency = 5; // We will try to list subscriptions for at most 5 account+tenants in parallel
|
|
@@ -58,7 +58,11 @@ export class AzureSubscriptionProviderBase {
|
|
|
58
58
|
return this.refreshSuggestedEmitter.event(callback, thisArg, disposables);
|
|
59
59
|
}
|
|
60
60
|
fireRefreshSuggestedIfNeeded(evtArgs) {
|
|
61
|
-
|
|
61
|
+
// subscriptionFilterChange is an explicit user action and must never be suppressed,
|
|
62
|
+
// otherwise re-selecting a subscription shortly after unselecting one gets swallowed
|
|
63
|
+
// by the debounce/silence window that the first refresh triggered.
|
|
64
|
+
if (evtArgs.reason !== 'subscriptionFilterChange' &&
|
|
65
|
+
(this.suppressRefreshSuggestedEvents || Date.now() < this.lastRefreshSuggestedTime + EventDebounce)) {
|
|
62
66
|
// Suppress and/or debounce events to avoid flooding
|
|
63
67
|
return false;
|
|
64
68
|
}
|
package/package.json
CHANGED