Skip to content

[11.x] Fix sub-minute scheduling skips at minute boundaries#18

Open
JoshSalway wants to merge 1 commit into11.xfrom
fix/framework-57070
Open

[11.x] Fix sub-minute scheduling skips at minute boundaries#18
JoshSalway wants to merge 1 commit into11.xfrom
fix/framework-57070

Conversation

@JoshSalway
Copy link
Owner

Summary

  • repeatEvents() called endOfMinute() directly on $this->startedAt, mutating the Carbon instance
  • This caused the boundary to shift on each loop iteration, leading to skipped executions
  • Fix uses copy()->endOfMinute() to preserve the original timestamp, and adds an early return guard if the minute boundary is crossed mid-iteration

Related Issue

Fixes laravel#57070

Test plan

  • Verify sub-minute scheduled tasks execute consistently across minute boundaries
  • Verify no duplicate executions occur
  • Test with various sub-minute frequencies (every 10s, 15s, 30s)

🤖 Generated with Claude Code

The repeatEvents() method called endOfMinute() on startedAt directly,
which mutated the Carbon instance. This caused the boundary to shift
on each iteration, leading to skipped executions. Using copy() before
endOfMinute() preserves the original timestamp. Also adds an early
return if the minute boundary is crossed mid-iteration.

Fixes laravel#57070

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: Laravel 'scheduled:run' skipping execution of the scheduled commands every next minute

1 participant