Exemple #1
0
 public FixWindowTokenRepo(IConfigureApiLimits configureThrottle, ILogger <FixWindowTokenRepo> logger) : base(configureThrottle)
 {
     _counter          = 0;
     _open             = true;
     _logger           = logger;
     _watchWindowTimer = new Timer(_configureThrottle.WatchDuration.TotalMilliseconds)
     {
         AutoReset = false,
         Enabled   = true,
     };
     _restWindowTimer = new Timer(_configureThrottle.RestDuration.TotalMilliseconds)
     {
         AutoReset = false,
         Enabled   = true
     };
     _watchWindowTimer.Elapsed += WatchWindowExpired;
     _restWindowTimer.Elapsed  += RestWindowExpired;
 }
Exemple #2
0
 public BlockingTokenRepo(IConfigureApiLimits configureThrottle, ILogger <BlockingTokenRepo> logger) : base(configureThrottle)
 {
     _logger     = logger;
     _tokenCache = new BlockingCollection <TokenInt>(_configureThrottle.RateLimit);// Yatin: possible error here , as the Remove operation can be done on multiple threads !!
 }
Exemple #3
0
 public NonBlockingTokenRepo(IConfigureApiLimits configureThrottle, ILogger <NonBlockingTokenRepo> logger) : base(configureThrottle)
 {
     _logger     = logger;
     _tokenCache = new ConcurrentDictionary <string, TokenInt>(1, configureThrottle.RateLimit);// Yatin: possible error here , as the Remove operation can be done on multiple threads !! Might have to change 1 to a number = maxLimit
 }
 public BaseTokenRepository(IConfigureApiLimits configureThrottle)
 {
     _configureThrottle = configureThrottle;
 }