Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3699

[Job Scheduling] A job scheduled using JobBuilder does not get removed if the JobConsumer returns JobResult.OK

    XMLWordPrintableJSON

Details

    Description

      Behavior:

      If we schedule a job to be executed at a specific time for a topic using:
      JobBuilder jobBuilder = jobManager.createJob(EVENT_TOPIC);
      jobBuilder.properties(props).schedule().at(activationTime).add();

      It first creates a node of type "slingevent:TimedEvent" in crx repository under "/var/eventing/scheduled-jobs" and when the exact time arrives (in this case activationTime), a node of type "slingevent:Job" gets created under assigned jobs and posts an event to the JobConsumer.

      Issue:

      When the JobConsumer returns JobResult.OK the node of type "slingevent:TimedEvent" (scheduled job) does not get removed from the list.
      Due to this issue, when the server restarts, all the jobs that were earlier scheduled and had finished with their execution, get executed again to become nodes of type "slingevent:Job" and again post an event to the JobConsumer. This happens for all the jobs scheduled for a time that is before the current time (when the server restarts)

      Desired:

      Although, we wish to have the scheduled jobs to persist even after the server restarts, but only the jobs that have not yet been executed should be executed after restart. This implies that all the jobs that are executed should be removed from the list of scheduled jobs once the JobConsumer gets the control.

      Attachments

        Activity

          People

            cziegeler Carsten Ziegeler
            anshika Anshika Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: