Bug: Task first run executes outside working time window
Resolved 💬 2 comments Opened Jan 14, 2026 by tuharju Closed Jan 14, 2026
Bug Description
When a scheduled task runs for the first time, it executes immediately regardless of the configured time window.
Steps to Reproduce
- Configure a schedule with time window (e.g., 06:00-23:00)
- Set
target_node=my2for the schedule - Enable the schedule outside of working hours (e.g., at 01:20)
- Observe that the task executes immediately
Expected Behavior
Task should wait until the time window opens (06:00) before first execution.
Actual Behavior
Task executes immediately at 01:20, outside the configured 06:00-23:00 window.
Log Evidence
2026-01-15 01:20:31 Executing job TaskMcfSyncV2
2026-01-15 01:20:32 Job completed successfully
2026-01-15 01:20:32 New Job [TaskMcfSyncV2] scheduled for: 2026-01-15T06:00:00+02:00
Note: After first run, next job is correctly scheduled within the time window (06:00).
Affected Components
JobExecutorService::executePendingJobs()Schedule::getNextScheduledRunTime()orScheduleService::calculatePatternNextRunTime()
Suggested Fix
When creating/scheduling a job, validate that scheduled_for falls within the time window. If not, calculate the next valid time within the window.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗