Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions OneSTools.EventLog.Exporter.Core/ClickHouse/ClickHouseStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,23 @@ public async Task WriteEventLogDataAsync(List<EventLogItem> entities,
item.Session
}).AsEnumerable();

try
for (int number_try = 0; number_try < 100; number_try++)
{
await copy.WriteToServerAsync(data, cancellationToken);
}
catch (Exception ex)
{
_logger?.LogError(ex, $"Failed to write data to {_databaseName}");
throw;
try
{
await copy.WriteToServerAsync(data, cancellationToken);
break;
}
catch (Exception ex)
{

await Task.Delay(1000);
if (number_try == 99)
{
_logger?.LogError(ex, $"Failed to write data to {_databaseName}");
throw;
}
}
}

_logger?.LogDebug($"{entities.Count} items were being written to {_databaseName}");
Expand Down