public void Increment(string key, ThrottleType throttleType) { if (BotConfig.Instance.Throttles.TryGetValue(throttleType, out var throttle)) { this.AddOrUpdate(key, throttle, true); } }
public Throttle(ThrottleType type, params Connection[] connections) { this.type = type; cons = new List<Connection>(connections.Length); foreach (Connection con in connections) { Add(con); } }
public bool IsThrottled(string key, ThrottleType throttleType) { if (BotConfig.Instance.Throttles.TryGetValue(throttleType, out var throttle)) { return(this.AddOrUpdate(key, throttle, false).TimesInvoked > throttle.Limit); } return(false); }
public Throttle(ThrottleType type, params Connection[] connections) { this.type = type; cons = new List <Connection>(connections.Length); foreach (Connection con in connections) { Add(con); } }
public ThrottleGroup(int maxBytesPerSecond, ThrottleType type, params Connection[] connections) { this.maxBytesPerSecond = maxBytesPerSecond; this.type = type; cons = new List<Connection>(connections.Length); foreach (Connection con in connections) { cons.Add(con); sentBytes += con.SentBytes; rcvdBytes += con.RcvdBytes; } }
public ThrottleGroup(int maxBytesPerSecond, ThrottleType type, params Connection[] connections) { this.maxBytesPerSecond = maxBytesPerSecond; this.type = type; cons = new List <Connection>(connections.Length); foreach (Connection con in connections) { cons.Add(con); sentBytes += con.SentBytes; rcvdBytes += con.RcvdBytes; } }