コード例 #1
0
        internal static ThrottlingPolicy GetDefaultOrganizationEffectiveThrottlingPolicy()
        {
            ThrottlingPolicy throttlingPolicy = EffectiveThrottlingPolicy.ReadGlobalThrottlingPolicyFromAD();

            throttlingPolicy.ConvertToEffectiveThrottlingPolicy(false);
            return(throttlingPolicy);
        }
コード例 #2
0
        // Token: 0x060071D6 RID: 29142 RVA: 0x00178F58 File Offset: 0x00177158
        internal virtual bool UpdatePolicy()
        {
            EffectiveThrottlingPolicy effectiveThrottlingPolicy = this.GetEffectiveThrottlingPolicy();

            if (effectiveThrottlingPolicy == null && Budget.OnPolicyUpdateForTest == null)
            {
                return(false);
            }
            if (TimeProvider.UtcNow - this.lastPolicyCheck >= Budget.PolicyUpdateCheckInterval)
            {
                this.lastPolicyCheck = TimeProvider.UtcNow;
                IThrottlingPolicy throttlingPolicy;
                if (Budget.OnPolicyUpdateForTest != null)
                {
                    throttlingPolicy = Budget.OnPolicyUpdateForTest(this.ThrottlingPolicy.FullPolicy);
                }
                else
                {
                    switch (effectiveThrottlingPolicy.ThrottlingPolicyScope)
                    {
                    case ThrottlingPolicyScopeType.Regular:
                        throttlingPolicy = ThrottlingPolicyCache.Singleton.Get(effectiveThrottlingPolicy.OrganizationId, effectiveThrottlingPolicy.Id);
                        break;

                    case ThrottlingPolicyScopeType.Organization:
                        throttlingPolicy = ThrottlingPolicyCache.Singleton.Get(effectiveThrottlingPolicy.OrganizationId);
                        break;

                    case ThrottlingPolicyScopeType.Global:
                        throttlingPolicy = ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy();
                        break;

                    default:
                        throw new NotSupportedException(string.Format("Unsupported enum value {0}.", effectiveThrottlingPolicy.ThrottlingPolicyScope));
                    }
                }
                if (!object.ReferenceEquals(effectiveThrottlingPolicy, throttlingPolicy))
                {
                    ExTraceGlobals.ClientThrottlingTracer.TraceDebug((long)this.GetHashCode(), "[Budget.UpdatePolicy] Obtained a refreshed policy from the cache.");
                    this.SetPolicy(throttlingPolicy, false);
                    return(true);
                }
            }
            return(false);
        }