Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14772

Repeating interval with start date instantiates too often

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Unresolved
    • Icon: L3 - Default L3 - Default
    • None
    • 7.17.0
    • engine
    • None

      Environment (Required on creation):

      Any Camunda environment.

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      While creating a process definition with a repeating interval and a start date (example R2/2022-07-18T09:18:00Z/PT1M), the Camunda engine will instantiate one more process instance compared to the repeating interval number specified (3 instead of 2 in the example).

      Steps to reproduce (Required on creation):

      Execute the test included in this PR:
      https://github.com/camunda/camunda-bpm-platform/pull/1968

      or the test submitted by krisdacoder:

        @Test
        public void shouldNotExceedNumberPeriodsWithTimeCycle() throws Exception {
          ClockUtil.setCurrentTime(parse("19700101-00:00:00"));
          DurationHelper dh = new DurationHelper("R2/1970-01-01T00:30:00/PT2M");
          assertEquals(parse("19700101-00:30:00"), dh.getDateAfter());
      
          // simulate some execution time of 10 seconds
          ClockUtil.setCurrentTime(parse("19700101-00:30:10"));
          assertEquals(parse("19700101-00:31:00"), dh.getDateAfter());
      
          // simulate some execution time of 10 seconds
          ClockUtil.setCurrentTime(parse("19700101-00:31:10"));
          assertNull("There must not be more than 2 repetitions",   dh.getDateAfter());
        }
      

      or create a process definition with a repeating interval including a start date e.g., "R2/2022-07-18T09:18:00Z/PT1M".

      Observed Behavior (Required on creation):

      The number of process instances instantiated is equal to the number of repetitions + 1.

      Expected behavior (Required on creation):

      The number of process instances instantiated should be equal to the number of repetitions.

      Root Cause (Required on prioritization):

      This loop which calculates the next date calculates the repeats based on the start date. When the start date is part of the expression though this leads to the timer firing once when the start date is reached and then n times to match the expression of Rn repeats.

      Solution Ideas (Optional):

      Hints (optional):

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              krisdacoder Kristjan Demiri
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: