Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 6db7500. In this commit, we introduce a logic to categorize a trigger as expired trigger by examining the calculated nextCheckTime is before NOW. However there are twice update in the schedule loop when the current schedule is right on time to trigger action. In this case, right after trigger actions, the reset time checker is invoked where the trigger's nextCheckTime will be updated to be next valid trigger time after current time; while at the end of the loop, there is also trigger.updateNextCheckTime() to be called, and because the new current time is greater than the last update's current time, it is possible, the updated nextCheckTime is already passed the new current time, and result in catogorizing trigger as EXPIRED trigger
Details
This PR is to remove the second trigger.updateCheckTime() for several reasons:
Test
Add two unit tests to ensure the expiration works properly as expected, and normal trigger should not get impacted.
Schedule System's unit test is normally hard to target on one single corner cases, as the logic is relying on "NOW" (the moment that flipping the trigger's check time), it's usually hard to define if the corner case would happen exactly in this run, we're more hoping the iterations itself would hit the cornor case if possible. Take one use case as an example, we expect the current time is right before the trigger time in several interations to monitor it's keeping performing as it is, but we could only precisely control the first check time, and hard to control later updates because the testing interval is different than the real time interval, if we mock everything to match real time, it would make the test lengthy and slow.