[변경] AptabaseClient.cs
- 종료 직전에 보내는 Event 누락 방지하기 위한 코드 수정 : 큐에 이벤트를 추가하면 +1, 큐에서 읽어와서 Event를 Send하면 -1하는 필드 추가 : 필드가 0이되기를 기다리는 함수 추가(대기 한계 시간 기본값 1500ms) [변경] AptabaseClientBase.cs - EventData에 ipAddredd 할당하는 코드 제거 : 매번 API 호출하면서 속도 지연의 원인이 됨 - aptabase-debug.log 파일 생성하는 코드 제거 : 파일 관리가 안되고 있으므로 제거
This commit is contained in:
@@ -73,13 +73,13 @@ internal class AptabaseClientBase : IAsyncDisposable
|
||||
if (eventData.Props is null)
|
||||
eventData.Props = new Dictionary<string, object>();
|
||||
|
||||
eventData.Props["ipAddress"] = await GetPublicIpAddress();
|
||||
//eventData.Props["ipAddress"] = await GetPublicIpAddress(); 느려서 제외. 필요하면 다른 방법 사용 요망
|
||||
|
||||
var body = JsonContent.Create(eventData);
|
||||
|
||||
var response = await _http.PostAsync("/api/v0/event", body);
|
||||
|
||||
var logPath = "aptabase-debug.log";
|
||||
//var logPath = "aptabase-debug.log"; //파일 관리 안되므로 제거. 필요하면 다른 방법 사용 요망
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -94,11 +94,11 @@ internal class AptabaseClientBase : IAsyncDisposable
|
||||
var responseBody = await response.Content.ReadAsStringAsync();
|
||||
|
||||
_logger?.LogError("Failed to perform TrackEvent due to {StatusCode} and response body {Body}", response.StatusCode, responseBody);
|
||||
File.AppendAllText(logPath, $"Failed to perform TrackEvent due to {response.StatusCode} and response body {responseBody}\n");
|
||||
//File.AppendAllText(logPath, $"{eventData.EventName} Failed to perform TrackEvent due to {response.StatusCode} and response body {responseBody}\n");
|
||||
}
|
||||
else
|
||||
{ var responseBody = await response.Content.ReadAsStringAsync();
|
||||
File.AppendAllText(logPath, $"TrackEvent successful with response body {responseBody}\n");
|
||||
//File.AppendAllText(logPath, $"{eventData.EventName} TrackEvent successful with response body {responseBody}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user