refactor: TraceHttpClient 增加线程等待

This commit is contained in:
Argo Zhang 2019-10-12 20:50:55 +08:00
parent b5539a875a
commit 574b2aeaf8
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 3 additions and 4 deletions

View File

@ -17,7 +17,6 @@ namespace Bootstrap.Client.DataAccess
/// 构造函数
/// </summary>
/// <param name="client"></param>
/// <param name="httpContextAccessor"></param>
public TraceHttpClient(HttpClient client) => _client = client;
/// <summary>
@ -25,7 +24,7 @@ namespace Bootstrap.Client.DataAccess
/// </summary>
/// <param name="context"></param>
/// <param name="user"></param>
public async void Post(HttpContext context, OnlineUser user)
public void Post(HttpContext context, OnlineUser user)
{
// 调用 后台跟踪接口
// http://localhost:50852/api/Traces
@ -33,7 +32,8 @@ namespace Bootstrap.Client.DataAccess
try
{
await _client.PostAsJsonAsync("", user, context.RequestAborted);
var t = _client.PostAsJsonAsync("", user, context.RequestAborted);
t.Wait(2000);
}
catch (Exception ex)
{

View File

@ -66,7 +66,6 @@ namespace UnitTest
/// <summary>
///
/// </summary>
/// <param name="t"></param>
/// <param name="callback"></param>
public static void RevokeMapper(Action callback)
{