Ejemplo n.º 1
0
 private static void UpdateThrottle(StackexchangeThrottle throttle, StackexchangeWrapper wrapper)
 {
     throttle.QuotaRemaining = wrapper.QuotaRemaining;
     if (throttle.QuotaRemaining + 1 == wrapper.QuotaMax)
     {
         throttle.QuotaResetTime = UnixEpoch.Now + (long)TimeSpan.FromDays(1).TotalSeconds;
     }
     throttle.BackoffUntil = wrapper.Backoff != default(int) ? UnixEpoch.Now + wrapper.Backoff : StackexchangeThrottle.UNKNOWN;
 }
Ejemplo n.º 2
0
 private static bool Unthrottled(StackexchangeThrottle throttle)
 {
     return(UnixEpoch.Now >= throttle.BackoffUntil &&
            (throttle.QuotaRemaining > 0 || throttle.QuotaRemaining == StackexchangeThrottle.UNKNOWN ||
             UnixEpoch.Now >= throttle.QuotaResetTime));
 }