dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
862 stars 468 forks source link

if a jobs is disabled remove any previously persisted instance #19541

Closed fabrizzio-dotCMS closed 1 year ago

fabrizzio-dotCMS commented 3 years ago

The following jobs are getting disabled in https://github.com/dotCMS/core/pull/19487

ENABLE_CLICKSTREAM_TRACKING=false ENABLE_DELETE_OLDER_CLICKSTREAMS=false linkchecker.enablejob=false

This is perfectly fine for fresh installs but we're missing scenarios on which there can be jobs already scheduled (previously persisted in the database) For such cases, we need to do an else condition on all the jobs listed in DotInitScheduler

something like what is done here:

if(UtilMethods.isSet(Config.getStringProperty("BINARY_CLEANUP_JOB_CRON_EXPRESSION"))) {
            .....                       
} else {
     Logger.info(DotInitScheduler.class, "BinaryCleanupJob Cron Job schedule disabled on this server");
                Logger.info(DotInitScheduler.class, "Deleting BinaryCleanupJob Job");
    if ((job = sched.getJobDetail("BinaryCleanupJob", DOTCMS_JOB_GROUP_NAME)) != null) {
            sched.deleteJob("BinaryCleanupJob", DOTCMS_JOB_GROUP_NAME);
          }
}

and remove the jobs if they were previously scheduled

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.