修复获取cachekey错误问题
output使用ThreadPool.QueueUserWorkItem
This commit is contained in:
@@ -47,13 +47,11 @@ public class OutputService : IOutputService
|
||||
records.Add(record);
|
||||
if (records.Count >= tasksOptions.OutPutOptions.FlushCount)
|
||||
{
|
||||
var temp= new List<DataRecord>();
|
||||
temp.AddRange(records);
|
||||
|
||||
var temp= new List<DataRecord>(records);
|
||||
ThreadPool.QueueUserWorkItem(async (queueState) =>
|
||||
{
|
||||
await FlushAsync(temp);
|
||||
});
|
||||
{
|
||||
await FlushAsync(temp);
|
||||
});
|
||||
|
||||
records.Clear();
|
||||
}
|
||||
@@ -65,15 +63,12 @@ public class OutputService : IOutputService
|
||||
}
|
||||
if (records.Count > 0)
|
||||
{
|
||||
var temp = new List<DataRecord>();
|
||||
temp.AddRange(records);
|
||||
var temp = new List<DataRecord>(records);
|
||||
ThreadPool.QueueUserWorkItem(async (queueState) =>
|
||||
{
|
||||
await FlushAsync(temp);
|
||||
});
|
||||
records.Clear();
|
||||
context.AddFinishTask();
|
||||
_logger.LogInformation("***** Finished Tasks Count:{FinishTaskCount} *****", context.FinishTaskCount);
|
||||
_logger.LogInformation("***** Mysql output thread completed *****");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user