generate bug修复
This commit is contained in:
@@ -222,9 +222,8 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
generateDetailMapper.insert(generateDetail);
|
||||
|
||||
String key = generateResultKey + ":" + taskId;
|
||||
Long expire = redisUtil.getExpire(key);
|
||||
GenerateResultVO generateResultVO = new GenerateResultVO(taskId, generateDetail.getId(), url, "Success");
|
||||
redisUtil.addToString(key, new Gson().toJson(generateResultVO), expire);
|
||||
redisUtil.addToString(key, new Gson().toJson(generateResultVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||
}
|
||||
|
||||
private void validateGeneraType(Generate generate, String text, Long elementId, String generateType) {
|
||||
@@ -527,6 +526,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelGenerate(Long userId, List<String> uniqueIdList, String timeZone) {
|
||||
// todo 取消待优化
|
||||
uniqueIdList.forEach(uniqueId -> {
|
||||
// 1、确认当前消息是否还在排队中
|
||||
Boolean exists = redisUtil.isElementExistsInZSet(consumptionOrderKey, uniqueId);
|
||||
@@ -550,6 +550,9 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
pythonService.cancelGenerateTask(uniqueId);
|
||||
}
|
||||
}
|
||||
String key = generateResultKey + ":" + uniqueId;
|
||||
redisUtil.addToString(key, new Gson().toJson(new GenerateResultVO(uniqueId, null, null, "Cancelled")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||
|
||||
// 3、考虑加一张表,专门用于记录哪些用户在什么时间进行了取消操作,包括已经异常的请求
|
||||
GenerateCancel generateCancel = new GenerateCancel(userId, uniqueId, DateUtil.getByTimeZone(timeZone));
|
||||
generateCancelMapper.insert(generateCancel);
|
||||
|
||||
Reference in New Issue
Block a user