修复 工单第一次连接失败bug
增加工单内log
This commit is contained in:
1 parent
324ca0c6e7
commit
6e5dfa92b8
11 files changed
+566
-560
No files matched your search
@@ -5,6 +5,8 @@ using OrderSupportTicket.Models;
|
||||
using OrderSupportTicket.Models.Api;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using WxOrder.Framework.Helpers;
|
||||
|
||||
@@ -31,7 +33,7 @@ public sealed class EventSourceTicketRealtimeService
|
||||
/// </summary>
|
||||
public TicketRealtimeState State { get; private set; } = TicketRealtimeState.Disconnected;
|
||||
|
||||
public void Start(TicketClientOptions options)
|
||||
public async Task Start(TicketClientOptions options)
|
||||
{
|
||||
if (_disposed)
|
||||
throw new ObjectDisposedException(nameof(EventSourceTicketRealtimeService));
|
||||
@@ -54,7 +56,7 @@ public sealed class EventSourceTicketRealtimeService
|
||||
}
|
||||
|
||||
SetState(TicketRealtimeState.Connecting, "连接中…");
|
||||
_ = RunAsync(source);
|
||||
await RunAsync(source);
|
||||
}
|
||||
|
||||
public Task StopAsync()
|
||||
@@ -217,8 +219,16 @@ public sealed class EventSourceTicketRealtimeService
|
||||
UriKind.Absolute);
|
||||
ConfigurationBuilder builder = Configuration.Builder(uri);
|
||||
builder.RequestHeader("X-AppIds", $"[\"{string.Join("\",\"", appIds)}\"]");
|
||||
builder.Logger(NLogger.Instance);
|
||||
//var proxy = new WebProxy("http://127.0.0.1:8081"); //
|
||||
//var handler = new HttpClientHandler
|
||||
//{
|
||||
// Proxy = proxy,
|
||||
// UseProxy = true
|
||||
//};
|
||||
//var client = new HttpClient(handler);
|
||||
//builder.HttpClient(client);
|
||||
builder._responseStartTimeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user