增加DomainConfig属性
This commit is contained in:
parent
001c6dddf7
commit
daef121bf2
@ -75,7 +75,7 @@ namespace FastGithub.Http
|
|||||||
private void OnLifetimeHttpHandlerDeactivate(LifetimeHttpHandler lifetimeHttpHandler)
|
private void OnLifetimeHttpHandlerDeactivate(LifetimeHttpHandler lifetimeHttpHandler)
|
||||||
{
|
{
|
||||||
// 切换激活状态的记录的实例
|
// 切换激活状态的记录的实例
|
||||||
var domainConfig = ((HttpClientHandler)lifetimeHttpHandler.InnerHandler!).DomainConfig;
|
var domainConfig = lifetimeHttpHandler.DomainConfig;
|
||||||
this.httpHandlerLazyCache[domainConfig] = this.CreateLifetimeHttpHandlerLazy(domainConfig);
|
this.httpHandlerLazyCache[domainConfig] = this.CreateLifetimeHttpHandlerLazy(domainConfig);
|
||||||
this.httpHandlerCleaner.Add(lifetimeHttpHandler);
|
this.httpHandlerCleaner.Add(lifetimeHttpHandler);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using FastGithub.Configuration;
|
||||||
|
using System;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@ -11,15 +12,21 @@ namespace FastGithub.Http
|
|||||||
{
|
{
|
||||||
private readonly Timer timer;
|
private readonly Timer timer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取域名配置
|
||||||
|
/// </summary>
|
||||||
|
public DomainConfig DomainConfig { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 具有生命周期的HttpHandler
|
/// 具有生命周期的HttpHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="handler">HttpHandler</param>
|
/// <param name="handler">HttpHandler</param>
|
||||||
/// <param name="lifeTime">拦截器的生命周期</param>
|
/// <param name="lifeTime">拦截器的生命周期</param>
|
||||||
/// <param name="deactivateAction">失效回调</param>
|
/// <param name="deactivateAction">失效回调</param>
|
||||||
public LifetimeHttpHandler(HttpMessageHandler handler, TimeSpan lifeTime, Action<LifetimeHttpHandler> deactivateAction)
|
public LifetimeHttpHandler(HttpClientHandler handler, TimeSpan lifeTime, Action<LifetimeHttpHandler> deactivateAction)
|
||||||
: base(handler)
|
: base(handler)
|
||||||
{
|
{
|
||||||
|
this.DomainConfig = handler.DomainConfig;
|
||||||
this.timer = new Timer(this.OnTimerCallback, deactivateAction, lifeTime, Timeout.InfiniteTimeSpan);
|
this.timer = new Timer(this.OnTimerCallback, deactivateAction, lifeTime, Timeout.InfiniteTimeSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user