public void SetTargetPoint(Transform point, ILimiter limiter, ILimiter yLimiter, string enterPoint = "Enter") { EnterPoint = point; Limit = limiter; YLimiter = yLimiter; UpdateLines(); }
public void SetTarget(Node target, ILimiter limiter, ILimiter yLimiter, string enterPoint = "Enter") { Target = target; EnterPoint = Target.GetEnterPoint(enterPoint); Limit = limiter; YLimiter = yLimiter; UpdateLines(); }
public ConsoleApp(ILogger <ConsoleApp> logger, IRabbitMqConsumerService consumerService, IRabbitMqSenderService senderService, IRabbitMqSenderServiceKeepConnection senderServiceKeepConnection, ILimiter limiter, AppConfig config) { _logger = logger; _consumerService = consumerService; _senderService = senderService; _senderServiceKeepConnection = senderServiceKeepConnection; _config = config; _consumerService.ServiceDescription = "Consumer Service"; _consumerService.ReceiveMessage += ProcessMessage; _consumerService.ShutdownConsumer += ProcessShutdown; _consumerService.ReceiveMessageError += ProcessError; _consumerService.Limiter = limiter; _consumerService.MaxChannelsPerConnection = 3; _senderService.ServiceDescription = "Sender Service"; }
/// <summary> /// Initializes a new instance of the <see cref="LimiterMiddleware"/> class. /// </summary> /// <param name="next">The next part of the request pipeline.</param> /// <param name="limiter">The limiter to use.</param> /// <param name="logger">The logger.</param> public LimiterMiddleware(RequestDelegate next, ILimiter limiter, ILogger <LimiterMiddleware> logger) { this.next = next; this.limiter = limiter; this.logger = logger; }
/// <summary> /// Rate limits a collection mapping. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="U"></typeparam> /// <param name="arr"></param> /// <param name="limiter"></param> /// <param name="f"></param> /// <returns></returns> public static Task <U[]> Select <T, U>( this IEnumerable <T> arr, ILimiter limiter, Func <T, int, Task <U> > f ) => arr.Select((x, i) => limiter.Run(() => f(x, i))).WhenAll();
public LimiterExhaustedException(ILimiter limiter) : base($"We've ran out of requests {limiter.History.Count()} out of {limiter.RateLimit.Amount} over {limiter.RateLimit.TimeFrame} will resets at {DateTime.Now.AddMilliseconds(limiter.ResetsAt)}") { }
public void SetTargetPoint(Transform point, ILimiter limiter, ILimiter yLimiter, string enterPoint = "Enter") { List.ForEach(x => x.SetTargetPoint(point, limiter, yLimiter, enterPoint)); }
public void SetTarget(Node target, ILimiter limiter, ILimiter yLimiter, string enterPoint = "Enter") { List.ForEach(x => x.SetTarget(target, limiter, yLimiter, enterPoint)); }