snac21 opened a new issue, #2492:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2492

   ### Problem
   
   Disabled/shutdown servers still record trace events to database.
   
   ### Proposed Solution
   
   ```java
   @Override
   public void postJobExecutionEvent(final JobExecutionEvent jobExecutionEvent) 
{
       if (!isJobEnabled()) {
           return;
       }
       jobTracingEventBus.post(jobExecutionEvent);
   }
   
   @Override
   public void postJobStatusTraceEvent(final String taskId, final State state, 
final String message) {
       if (!isJobEnabled()) {
           return;
       }
       TaskContext taskContext = TaskContext.from(taskId);
       jobTracingEventBus.post(new JobStatusTraceEvent(...));
   }
   
   public boolean isJobEnabled() {
       if (JobRegistry.getInstance().isShutdown(jobName)) {
           return false;
       }
       JobInstance jobInstance = 
JobRegistry.getInstance().getJobInstance(jobName);
       return null != jobInstance && 
serverService.isEnableServer(jobInstance.getServerIp());
   }
   ```


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to