修复获取cachekey错误问题
output使用ThreadPool.QueueUserWorkItem
This commit is contained in:
@@ -77,33 +77,33 @@ public class MainHostedService : BackgroundService
|
||||
};
|
||||
var bigTableContext = new ProcessContext();
|
||||
var bigTableOptions = new TasksOptions { TableInfoConfig = bigTablesDic, OutPutOptions = new OutPutOptions { FlushCount = 10000, OutPutTaskCount = 2 } };
|
||||
//taskFun(bigTableOptions,new DataRecordQueue(), new DataRecordQueue(), bigTableContext);
|
||||
taskFun(bigTableOptions,new DataRecordQueue(), new DataRecordQueue(), bigTableContext);
|
||||
var smallTablesDic = new Dictionary<string, TableInfo>
|
||||
{
|
||||
//{"machine",new TableInfo{SimulaRowCount=14655 }},
|
||||
//{"order",new TableInfo{SimulaRowCount=5019216 }},
|
||||
//{"order_data_block",new TableInfo{SimulaRowCount=731800334 }},
|
||||
//{"order_data_goods",new TableInfo{SimulaRowCount=25803671 }},
|
||||
//{"order_data_parts",new TableInfo{SimulaRowCount=468517543 }},
|
||||
//{"order_module",new TableInfo{SimulaRowCount=103325385 }},
|
||||
//{"order_module_extra",new TableInfo{SimulaRowCount=54361321 }},
|
||||
//{"order_module_item",new TableInfo{SimulaRowCount=69173339 }},
|
||||
//{"order_package",new TableInfo{SimulaRowCount=16196195 }},
|
||||
{"machine",new TableInfo{SimulaRowCount=14655 }},
|
||||
{"order",new TableInfo{SimulaRowCount=5019216 }},
|
||||
{"order_data_block",new TableInfo{SimulaRowCount=731800334 }},
|
||||
{"order_data_goods",new TableInfo{SimulaRowCount=25803671 }},
|
||||
{"order_data_parts",new TableInfo{SimulaRowCount=468517543 }},
|
||||
{"order_module",new TableInfo{SimulaRowCount=103325385 }},
|
||||
{"order_module_extra",new TableInfo{SimulaRowCount=54361321 }},
|
||||
{"order_module_item",new TableInfo{SimulaRowCount=69173339 }},
|
||||
{"order_package",new TableInfo{SimulaRowCount=16196195 }},
|
||||
{"order_process",new TableInfo{SimulaRowCount=3892685 }},//orderNo < 202301的
|
||||
{"order_process_step",new TableInfo{SimulaRowCount=8050349 }},//orderNo < 202301的删除
|
||||
{"order_process_step_item",new TableInfo{SimulaRowCount=14538058 }},//orderNo < 202301的删除
|
||||
//{"order_scrap_board",new TableInfo{SimulaRowCount=123998 }},
|
||||
//{"process_group",new TableInfo{SimulaRowCount=1253 }},
|
||||
//{"process_info",new TableInfo{SimulaRowCount=7839 }},
|
||||
//{"process_item_exp",new TableInfo{SimulaRowCount=28 }},
|
||||
//{"process_schdule_capacity",new TableInfo{SimulaRowCount=39736 }},
|
||||
//{"process_step_efficiency",new TableInfo{SimulaRowCount=8 }},
|
||||
//{"report_template",new TableInfo{SimulaRowCount=7337 }},
|
||||
//{"simple_package",new TableInfo{SimulaRowCount=130436 }},//orderNo < 202301的删除
|
||||
//{"sys_config",new TableInfo{SimulaRowCount=2296 }},
|
||||
//{"work_calendar",new TableInfo{SimulaRowCount=11 }},
|
||||
//{"work_shift",new TableInfo{SimulaRowCount=59 }},
|
||||
//{"work_time",new TableInfo{SimulaRowCount=62 }},
|
||||
{"order_scrap_board",new TableInfo{SimulaRowCount=123998 }},
|
||||
{"process_group",new TableInfo{SimulaRowCount=1253 }},
|
||||
{"process_info",new TableInfo{SimulaRowCount=7839 }},
|
||||
{"process_item_exp",new TableInfo{SimulaRowCount=28 }},
|
||||
{"process_schdule_capacity",new TableInfo{SimulaRowCount=39736 }},
|
||||
{"process_step_efficiency",new TableInfo{SimulaRowCount=8 }},
|
||||
{"report_template",new TableInfo{SimulaRowCount=7337 }},
|
||||
{"simple_package",new TableInfo{SimulaRowCount=130436 }},//orderNo < 202301的删除
|
||||
{"sys_config",new TableInfo{SimulaRowCount=2296 }},
|
||||
{"work_calendar",new TableInfo{SimulaRowCount=11 }},
|
||||
{"work_shift",new TableInfo{SimulaRowCount=59 }},
|
||||
{"work_time",new TableInfo{SimulaRowCount=62 }},
|
||||
};
|
||||
var smallTableContext = new ProcessContext();
|
||||
taskFun(new TasksOptions { TableInfoConfig = smallTablesDic, OutPutOptions = new OutPutOptions { FlushCount = 20000, OutPutTaskCount = 4 } },
|
||||
|
@@ -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