sandynz commented on code in PR #17801:
URL: https://github.com/apache/shardingsphere/pull/17801#discussion_r876907204


##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/PipelineJobExecutor.java:
##########
@@ -112,15 +109,22 @@ private Optional<JobConfigurationPOJO> 
getJobConfigPOJO(final DataChangedEvent e
     }
     
     private void execute(final JobConfigurationPOJO jobConfigPOJO) {
-        if 
(!RuleAlteredJobSchedulerCenter.existJob(jobConfigPOJO.getJobName())) {
-            log.info("{} added to executing jobs success", 
jobConfigPOJO.getJobName());
-            new OneOffJobBootstrap(PipelineAPIFactory.getRegistryCenter(), new 
RuleAlteredJob(), jobConfigPOJO.toJobConfiguration()).execute();
+        RuleAlteredJobConfiguration jobConfig = 
RuleAlteredJobConfigurationSwapper.swapToObject(jobConfigPOJO.getJobParameter());
+        String databaseName = jobConfig.getDatabaseName();
+        if (PipelineSimpleLock.getInstance().tryLock(databaseName, 3000)) {
+            if 
(!RuleAlteredJobSchedulerCenter.existJob(jobConfigPOJO.getJobName())) {

Review Comment:
   It's better to put `existJob` up on `tryLock` to reduce lock.



-- 
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: notifications-unsubscr...@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to