Add @after schedule with grace period for late job creation #1883
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.
Proposed changes
Implements
@afterschedule keyword to handle jobs created after their intended execution time. When a job with@at 2020-01-01T00:00:00Zis created at 00:00:30 due to network latency, it never runs. The@aftersyntax adds a configurable grace period during which late jobs execute immediately.Syntax:
Behavior:
Implementation:
extcron/duration.go- ISO8601 duration parser (PT2H, P1D, P1DT2H30M)extcron/after.go- AfterSchedule type with grace period logicextcron/extparser.go- Parser integration for@aftersyntaxExample use case:
{ "name": "maintenance-job", "schedule": "@after 2025-01-01T02:00:00Z <PT1H", "executor": "shell", "executor_config": {"command": "run-maintenance.sh"} }Job runs at 02:00 if created before, or immediately if created between 02:00-03:00. Prevents missed executions due to API latency while maintaining temporal bounds.
Types of changes
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
client.badssl.com/tmp/go-build4267140409/b375/http.test /tmp/go-build4267140409/b375/http.test -test.testlogfile=/tmp/go-build4267140409/b375/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build4267140409/b277/vet.cfg x64/src/runtime/-p 1xTF/_m0GZAbddpzgithub.com/mattn/go-isatty /opt/hostedtoolc-lang=go1.15(dns block)self-signed.badssl.com/tmp/go-build4267140409/b375/http.test /tmp/go-build4267140409/b375/http.test -test.testlogfile=/tmp/go-build4267140409/b375/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build4267140409/b277/vet.cfg x64/src/runtime/-p 1xTF/_m0GZAbddpzgithub.com/mattn/go-isatty /opt/hostedtoolc-lang=go1.15(dns block)untrusted-root.badssl.com/tmp/go-build4267140409/b375/http.test /tmp/go-build4267140409/b375/http.test -test.testlogfile=/tmp/go-build4267140409/b375/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build4267140409/b277/vet.cfg x64/src/runtime/-p 1xTF/_m0GZAbddpzgithub.com/mattn/go-isatty /opt/hostedtoolc-lang=go1.15(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.