整理代码
This commit is contained in:
@@ -54,20 +54,22 @@ public class OutputService : IOutputService
|
||||
}
|
||||
if (_context.GetExceptions().Count>0)
|
||||
{
|
||||
_logger.LogInformation("***** Csv output service is canceled *****");
|
||||
_logger.LogInformation("***** Csv output thread is canceled *****");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_context.IsTransformCompleted && records.Count > 0)
|
||||
if (records.Count > 0)
|
||||
{
|
||||
await FlushAsync(records);
|
||||
records.Clear();
|
||||
_context.CompleteOutput();
|
||||
_logger.LogInformation("***** Mysql output service completed *****");
|
||||
_logger.LogInformation("***** Mysql output thread completed *****");
|
||||
}
|
||||
}, _options.Value.TaskCount);
|
||||
|
||||
await _taskManager.WaitAll();
|
||||
//_context.CompleteOutput();
|
||||
_logger.LogInformation(@"***** Mysql output service completed *****");
|
||||
|
||||
}
|
||||
|
||||
private async Task FlushAsync(IEnumerable<DataRecord> records)
|
||||
|
@@ -65,7 +65,7 @@ public class TransformService : ITransformService
|
||||
field = string.IsNullOrEmpty(field) ? "''" : _options.Value.TransformBinary?.Invoke(field) ?? field; ;
|
||||
break;
|
||||
case ColumnType.Blob:
|
||||
field = string.IsNullOrEmpty(field) ? "NULL" : $"0x{field}";
|
||||
//field = string.IsNullOrEmpty(field) ? "NULL" : $"0x{field}";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -88,7 +88,7 @@ public class TransformService : ITransformService
|
||||
_consumerQueue.Enqueue(record);
|
||||
//数据增加
|
||||
var addRecords=_options.Value.RecordAdd?.Invoke(record);
|
||||
if(addRecords != null)
|
||||
if(addRecords != null&& addRecords.Count>0)
|
||||
{
|
||||
foreach(var rc in addRecords)
|
||||
{
|
||||
|
Reference in New Issue
Block a user