You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "davidzollo (via GitHub)" <gi...@apache.org> on 2023/07/04 06:37:06 UTC
[GitHub] [dolphinscheduler] davidzollo commented on a diff in pull request #14430: [FIX-14299][api]: check schedule exists
davidzollo commented on code in PR #14430:
URL: https://github.com/apache/dolphinscheduler/pull/14430#discussion_r1251554384
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java:
##########
@@ -167,6 +167,13 @@ public Map<String, Object> insertSchedule(User loginUser,
executorService.checkProcessDefinitionValid(projectCode, processDefinition, processDefineCode,
processDefinition.getVersion());
+ Schedule scheduleExists =
+ scheduleMapper.queryByProcessDefinitionCode(processDefineCode);
+ if (scheduleExists != null) {
+ throw new ServiceException(Status.SCHEDULE_ALREADY_EXISTS, processDefineCode,
Review Comment:
It's a very good beginning for you to start the first contribution.
You can prompt the user in a more friendly style, instead of throwing exceptions. Here is an example:
```
log.warn("The schedule already exists.");
putMsg(result, Status.SCHEDULE_ALREADY_EXISTS);
return result;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org