Exemplo n.º 1
0
        internal static TokenBucket GetOrCreateBucket(string name)
        {
            if (!RateLimiter.buckets.ContainsKey(name))
            {
                RateLimiter.SetRateLimit(name, 1500, new TimeSpan(0, 0, 100));
            }

            return(RateLimiter.buckets[name]);
        }
Exemplo n.º 2
0
 private static void SetDefaultRateLimits()
 {
     RateLimiter.SetRateLimit(new DirectoryService().Name, 1500, new TimeSpan(0, 0, 100));
     RateLimiter.SetRateLimit(new GroupssettingsService().Name, 500, new TimeSpan(0, 0, 100));
     RateLimiter.SetRateLimit(new CalendarService().Name, 1500, new TimeSpan(0, 0, 100));
     RateLimiter.SetRateLimit(new GmailService().Name, 250, new TimeSpan(0, 0, 1));
     RateLimiter.SetRateLimit(typeof(ContactsService).Name, 1500, new TimeSpan(0, 0, 100));
     RateLimiter.SetRateLimit(new ClassroomService().Name, 5, new TimeSpan(0, 0, 1));
 }
Exemplo n.º 3
0
 public static void SetRateLimitClassroomService(int requestsPerInterval, TimeSpan interval)
 {
     RateLimiter.SetRateLimit(new ClassroomService().Name, requestsPerInterval, interval);
 }
Exemplo n.º 4
0
 public static void SetRateLimitContactsService(int requestsPerInterval, TimeSpan interval)
 {
     RateLimiter.SetRateLimit(typeof(ContactsService).Name, requestsPerInterval, interval);
 }
Exemplo n.º 5
0
 public static void SetRateLimitGroupSettingsService(int requestsPerInterval, TimeSpan interval)
 {
     RateLimiter.SetRateLimit(new GroupssettingsService().Name, requestsPerInterval, interval);
 }
Exemplo n.º 6
0
 public static void SetRateLimitDirectoryService(int requestsPerInterval, TimeSpan interval)
 {
     RateLimiter.SetRateLimit(new DirectoryService().Name, requestsPerInterval, interval);
 }