public WebRequestServices(TrueShipConfiguration config, ThrottlerAsync throttler) { Condition.Requires(config, "config").IsNotNull(); this._config = config; this._throttler = throttler; JsonCustomSerializationOptionsProvider.Setup(); }
public virtual void Init() { _callCounter = 0; _callCounterFunc = () => _callCounter++; if (IsAsyncVersion) { ThrottlerAsync = GetThrottlerFuncAsync(); _throttlerExecute = x => ThrottlerAsync.ExecuteAsync(() => Task.FromResult(x())).GetAwaiter().GetResult(); } else { Throttler = GetThrottlerFunc(); _throttlerExecute = x => Throttler.Execute(x); } }