diff --git a/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java b/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java index f8de73d..dc21d0f 100644 --- a/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java +++ b/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java @@ -31,6 +31,7 @@ import javax.annotation.Resource; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.concurrent.TimeUnit; import static com.muyu.task.server.thread.OptimizedPrioritizedThreadPool.*; @@ -253,6 +254,11 @@ public class TaskInfoServiceImpl extends ServiceImpl i submitHighPriorityTask(()->{ getString(pageNum, finalFieName, finalJoint,basicId,newBasicId,tableId,map,num); }); + try { + TimeUnit.MILLISECONDS.sleep(100); // 适当延迟,避免所有任务同时提交 + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } } } if (Weight.centre.getValue().equals(weight)){ @@ -304,9 +310,9 @@ public class TaskInfoServiceImpl extends ServiceImpl i @NotNull private void getString(Long pageNum,String fieName,String joint,Long basicId,Long newBasicId,Long tableId,HashMap map ,Integer num) { String sqlSelect = " SELECT " + fieName + " FROM " + joint +" limit "+pageNum +","+PAGE_SIZE; - //log.info(sqlSelect); + log.info(sqlSelect); - //log.info("执行{}查询的方法",sqlSelect); + log.info("执行{}查询的方法",sqlSelect); Result tableValueResult = datasourceFeign.findTableValueToArray(basicId, sqlSelect); DataValue[][] data = tableValueResult.getData(); // if (pageNum==160000){ @@ -323,10 +329,10 @@ public class TaskInfoServiceImpl extends ServiceImpl i dataValue.setKey(newKey); } } - //log.info("{}查询结束",sqlSelect); - //log.info("执行{}添加的方法",sqlSelect); + log.info("{}查询结束",sqlSelect); + log.info("执行{}添加的方法",sqlSelect); Result result = datasourceFeign.addProduct(newBasicId, tableId, data); - //log.info("{}添加结束",sqlSelect); + log.info("{}添加结束",sqlSelect); // for (List dataValues : tableValue) { // for (DataValue dataValue : dataValues) { // String key = dataValue.getKey();