-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid timer cycle with start time triggering multiple times #10054
Avoid timer cycle with start time triggering multiple times #10054
Conversation
Hi @korthout. Please take a moment to check this out. 🙇 |
Thanks @lzgabel I'll need a bit more time to understand this change. In the meantime, please provide a test case that shows the new behavior. |
I've submitted test cases.
Hi @korthout. I'm very sorry for disrupting your work schedule. 🙇 ❓ Since Philipp was the reviewer of the last PR #9418, it may be more appropriate for him to review this directly. WDYT? cc @saig0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additions @lzgabel ❤️
👍 I like your test. It made it much more clear what is happening.
❌ IMO, we need another test that verifies the behavior at the processing level.
Let me know if you have any questions on how to write that test.
bpmn-model/src/test/java/io/camunda/zeebe/model/bpmn/util/time/RepeatingIntervalTest.java
Show resolved
Hide resolved
883e81a
to
f9fbb19
Compare
5f7b8a5
to
5cafc47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lzgabel
👍 I like the test, but I don't think the behavior is correct yet.
❌ Please have a look at my change request.
bpmn-model/src/main/java/io/camunda/zeebe/model/bpmn/util/time/Interval.java
Outdated
Show resolved
Hide resolved
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Outdated
Show resolved
Hide resolved
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Outdated
Show resolved
Hide resolved
5cafc47
to
3ce1342
Compare
Hi @korthout. Please take a moment to check this out. 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lzgabel ❤️
❌ The timer is still scheduled immediately, which would lead to multiple triggers after downtime. Please have a look at my comments.
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Outdated
Show resolved
Hide resolved
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Outdated
Show resolved
Hide resolved
09d1f98
to
2435a06
Compare
Hi @korthout. Since I ran into a flaky test after the test, I've appended a commit. Please check this out. Sorry for the increased review workload. 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work @lzgabel 👍
This implementation fixes the bug 🎉
❌ I have one change request for the test to make sure it verifies the behavior correctly.
💭 There is one small flaw of this implementation: This version doesn't trigger the timer immediately if the start time of the cycle is in the past during the deployment of the process model. Instead, it creates the timer to be due after one interval period. This isn't necessarily wrong but could be unexpected. We can create a separate issue for this. Previously, I mentioned we could add a validation against using time cycles with a start time in the past. But, now I no longer think we should do this because the timer still triggers after one interval period, so I think this is reasonable behavior for 90% of use cases.
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Show resolved
Hide resolved
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Show resolved
Hide resolved
engine/src/test/java/io/camunda/zeebe/engine/processing/timer/TimerStartEventTest.java
Show resolved
Hide resolved
The PR description currently contains:
🔧 Please make it clear, that this is not the current behavior. Currently,
|
If a repeating timer with a start time is defined, the engine is stopped for some time during which the timer is supposed to trigger multiple times, and the engine is restarted, then it should trigger only once and reschedule the next timer in the future. Also, if a past start time is defined, it triggers after one interval period. If a future start time is defined that is expected sooner than, at, or after one interval period, it triggers at the start time.
Avoid timer cycle with start time triggering multiple times, if a repeating timer with a start time is defined, the start time should not be less than current time.
2435a06
to
f95cd72
Compare
Hi @korthout. I've fixed review comments. Please check this out. 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build succeeded: |
Description
If a repeating timer with a start time is defined, the engine is stopped for some time during which the timer is supposed to trigger multiple times, and the engine is restarted, then it should trigger only once and reschedule the next timer in the future. Also, if a past start time is defined, it triggers after one interval period. If a future start time is defined that is expected sooner than, at, or after one interval period, it triggers at the start time.
Related issues
closes #9680
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
backport stable/1.3
) to the PR, in case that fails you need to create backports manually.Testing:
Documentation:
Please refer to our review guidelines.