修复获取cachekey错误问题

output使用ThreadPool.QueueUserWorkItem
This commit is contained in:
2024-01-19 15:14:01 +08:00
parent e3f6ecbd91
commit f167256082
5 changed files with 45 additions and 50 deletions

View File

@@ -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 *****");
}
}