Browse Source

feign 链接时长

pt
zhizhi wu 4 years ago
parent
commit
152480e157
  1. 6
      cloudutil/src/main/resources/application-util-dev.yml
  2. 19
      cloudutil/src/main/resources/application-util-green.yml
  3. 4
      cloudutil/src/main/resources/application-util-greenvalley.yml
  4. 4
      cloudutil/src/main/resources/application-util-prod.yml
  5. 6
      cloudutil/src/main/resources/application-util-prodsd.yml
  6. 10
      cloudutil/src/main/resources/application-util-test.yml
  7. 34
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/ProjectService.java

6
cloudutil/src/main/resources/application-util-dev.yml

@ -31,8 +31,8 @@ eureka:
status-page-url-path: ${server.servlet.context-path}/actuator/info
health-check-url-path: ${server.servlet.context-path}/actuator/health
ribbon:
ConnectTimeout: 50000
ReadTimeout: 50000
ConnectTimeout: 60000
ReadTimeout: 60000
feign:
client:
config:
@ -50,6 +50,8 @@ hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:

19
cloudutil/src/main/resources/application-util-green.yml

@ -107,6 +107,25 @@ feign:
loggerLevel: basic
hystrix:
enabled: true
hystrix:
threadpool:
default:
coreSize: 200 #并发执行的最大线程数,默认10
maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

4
cloudutil/src/main/resources/application-util-greenvalley.yml

@ -51,6 +51,10 @@ hystrix:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

4
cloudutil/src/main/resources/application-util-prod.yml

@ -59,6 +59,10 @@ hystrix:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

6
cloudutil/src/main/resources/application-util-prodsd.yml

@ -55,10 +55,16 @@ hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

10
cloudutil/src/main/resources/application-util-test.yml

@ -101,8 +101,8 @@ feign:
client:
config:
default:
connectTime: 5000
readTimeout: 5000
connectTime: 60000
readTimeout: 60000
# NONE【性能最佳,适用于生产】:不记录任何日志(默认值)。
# BASIC【适用于生产环境追踪问题】:仅记录请求方法、URL、响应状态代码以及执行时间。
# HEADERS:记录BASIC级别的基础上,记录请求和响应的header。
@ -114,10 +114,16 @@ hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

34
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/ProjectService.java

@ -62,6 +62,24 @@ public class ProjectService implements IProjectService {
@Override
public void saveData(Long startTime, StepTask stepTask, Long operationId, byte operation) {
// 判断是否为结束结点
Step step = stepDao.selectByPrimaryKey(stepTask.getStepId());
Integer max = stepDao.getMaxSequence(Constant.STEP_TYPE_REAL);
if (step != null && max != null && step.getSequence() != null && step.getSequence().intValue() == max.intValue()) {
// 修改平车结束时间点
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(stepTask.getTaskSubId());
if (bindCar == null) {
log.info("出现异常,未找到绑定平车:{}", stepTask.getTaskSubId());
throw new BaseException(CodeEnum.PARAM_ERROR);
}
if (bindCar.getEndTime() == null || bindCar.getEndTime() == 0) {
PatientWisdomCar patientWisdomCar = new PatientWisdomCar();
patientWisdomCar.setId(bindCar.getId());
patientWisdomCar.setEndTime(startTime);
patientWisdomCarMapper.updateByPrimaryKeySelective(patientWisdomCar);
}
}
PatientDataExample dataExample = new PatientDataExample();
dataExample.createCriteria().andTaskSubIdEqualTo(stepTask.getTaskSubId()).andStepIdEqualTo(stepTask.getStepId());
List<PatientData> patientData = patientDataDao.selectByExample(dataExample);
@ -78,21 +96,7 @@ public class ProjectService implements IProjectService {
return;
}
// 判断是否为结束结点
Step step = stepDao.selectByPrimaryKey(stepTask.getStepId());
Integer max = stepDao.getMaxSequence(Constant.STEP_TYPE_REAL);
if (step != null && max != null && step.getSequence() != null && step.getSequence().intValue() == max.intValue()) {
// 修改平车结束时间点
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(stepTask.getTaskSubId());
if (bindCar == null) {
log.info("出现异常,未找到绑定平车:{}", stepTask.getTaskSubId());
throw new BaseException(CodeEnum.PARAM_ERROR);
}
PatientWisdomCar patientWisdomCar = new PatientWisdomCar();
patientWisdomCar.setId(bindCar.getId());
patientWisdomCar.setEndTime(startTime);
patientWisdomCarMapper.updateByPrimaryKeySelective(patientWisdomCar);
}
PatientData data = new PatientData();
data.setId(snowflake.nextId());

Loading…
Cancel
Save