Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix](Job)Fix the Calculation of the First Trigger Time and Add a Sin…
…gle-Time Scheduling Compensation Logic ### Background: The previous scheduling logic for calculating the first trigger time had the following issues: If the current time (currentTimeMs) exceeds the start of the time window (windowStartTimeMs), the first trigger time could be skipped, causing some tasks to be missed. Minor delays during code execution (e.g., between window initialization and scheduling logic execution) could result in tasks being missed within the active time window. ### Solution: - Adjustment of First Trigger Time Logic: When the initially calculated firstTriggerTime is less than or equal to the currentTimeMs, compute the number of missed intervals and directly adjust to the largest trigger time that is less than the currentTimeMs. - Single-Time Compensation Logic: Introduced a compensation mechanism to handle the slight delay caused by code execution. This ensures that tasks missed during the initialization phase are correctly scheduled. The compensation is explicitly single-time to avoid impacting the normal scheduling logic.
- Loading branch information