|
|
|
@ -55,6 +55,10 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu |
|
|
|
|
|
|
|
private final List<Integer> list = Arrays.asList(0, 1, 2, 3); |
|
|
|
|
|
|
|
|
|
|
|
@Value("${question.generation.downgrade:true}") |
|
|
|
private Boolean downgrade; |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成题目 |
|
|
|
* 1. 先尝试调用算法服务生成真实题目 |
|
|
|
@ -73,6 +77,11 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu |
|
|
|
log.info(">>> [题目生成] 开始生成题目, TaskId: {}, ClusterId: {}, 题型: {}, 数量: {}", |
|
|
|
taskId, clusterId, questionType, num); |
|
|
|
|
|
|
|
if (downgrade){ |
|
|
|
generateFallbackQuestions(dtoList, questionType, num); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
// 应用限流:获取令牌,超过限流速率则等待
|
|
|
|
long waitStart = System.currentTimeMillis(); |
|
|
|
@ -96,9 +105,6 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu |
|
|
|
taskId, e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
//熔断降级:算法服务失败时使用硬编码生成默认题目
|
|
|
|
// log.info(">>> [题目生成] 启用熔断降级,生成默认题目");
|
|
|
|
// generateFallbackQuestions(dtoList, questionType, num);
|
|
|
|
//发送预警通知
|
|
|
|
notifyUtil.notify(taskId,clusterId); |
|
|
|
} |
|
|
|
|