Damien Obrist created SLING-5666:
------------------------------------

             Summary: Unscheduling a job should remove corresponding node
                 Key: SLING-5666
                 URL: https://issues.apache.org/jira/browse/SLING-5666
             Project: Sling
          Issue Type: Bug
          Components: Extensions
    Affects Versions: Event 4.0.0
            Reporter: Damien Obrist


Unscheduling a previously scheduled job does not remove the corresponding node 
below {{/var/eventing/scheduled-jobs}}:

{code:java}
ScheduledJobInfo info =  jobManager.createJob(topic).schedule().at(date).add();
// creates /var/eventing/scheduled-jobs/c204a1ad-b161-4e76-9dfe-4152bca088cf
info.unschedule();
// /var/eventing/scheduled-jobs/c204a1ad-b161-4e76-9dfe-4152bca088cf persists
{code}

This can lead to the situation where 
[ScheduledJobHandler#scan|https://github.com/apache/sling/blob/caba56abb49cb173cf6c9903a0facb2b6d31e56c/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/ScheduledJobHandler.java#L142-L174]
 picks the node back up again and reschedules the job.

This is a regression introduced by SLING-4680. Before the changes of 
SLING-4680, {{JobSchedulerImpl#unschedule}} took care of [removing the 
node|https://github.com/apache/sling/blob/6eaa6a131b4013c5b4990ee126f6af1c5710d5de/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java#L335-L353].
 Currently, this is [not being done 
anymore|https://github.com/apache/sling/blob/caba56abb49cb173cf6c9903a0facb2b6d31e56c/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java#L196-L202].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to