修复 工单第一次连接失败bug

增加工单内log
This commit is contained in:
chfei committed 2026-10-20 10:20:57 +08:00
1 parent 324ca0c6e7
commit 6e5dfa92b8
11 files changed
+566 -560

No files matched your search

@@ -7,6 +7,7 @@ using System.Net.Http.Headers;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using WxOrder.Framework.Helpers;
using static LaunchDarkly.EventSource.AsyncHelpers;
@@ -23,6 +24,7 @@ namespace LaunchDarkly.EventSource
private readonly Configuration _configuration;
private readonly HttpClient _httpClient;
private readonly ILogger _logger;
private const string UserAgentProduct = "DotNetClient";
internal static readonly string UserAgentVersion = ((AssemblyInformationalVersionAttribute)typeof(EventSource)
@@ -48,10 +50,11 @@ namespace LaunchDarkly.EventSource
#region Constructors
internal EventSourceService(Configuration configuration, HttpClient httpClient)
internal EventSourceService(Configuration configuration, HttpClient httpClient, ILogger logger)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
#endregion
@@ -85,6 +88,9 @@ namespace LaunchDarkly.EventSource
CancellationToken cancellationToken
)
{
_logger.Debug(string.Format("Making {0} request to EventSource URI {1}",
_configuration.Method ?? HttpMethod.Get,
_configuration.Uri));
var request = CreateHttpRequestMessage(_configuration.Uri, lastEventId);
@@ -94,7 +100,8 @@ namespace LaunchDarkly.EventSource
HttpCompletionOption.ResponseHeadersRead,
cancellationToken).ConfigureAwait(false))
{
ValidateResponse(response);
_logger.Debug(string.Format("Response status: {0}", (int)response.StatusCode));
ValidateResponse(response);
using (var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
{
@@ -109,10 +116,12 @@ namespace LaunchDarkly.EventSource
if (_configuration.PreferDataAsUtf8Bytes)
{
_logger.Debug("Reading UTF-8 stream without string conversion");
await ProcessResponseFromUtf8StreamAsync(processResponseLineUTF8, stream, cancellationToken);
}
else
{
_logger.Debug("Reading stream with string conversion");
using (var reader = new StreamReader(stream, Encoding.UTF8,
detectEncodingFromByteOrderMarks: true, bufferSize: ReadBufferSize))
{