Scheduled jobs: work out timezone and idempotency first
Give retry on failure, concurrency locking, and compensation
Prompt
Copy it whole, then replace the brackets with your own contentHandle this coding task: Cron Jobs: Time Zones and Idempotency First. Code/error: [paste] Environment: [language/version/framework] Requirements: Cover retry on failure, concurrency locks, and compensation. Give the diagnosis first, then the changes, then how to verify.
Replace the text in [ ] with your own situation; ask long tasks in stages.
How to get better results
Read this before you fill it inFor scheduled jobs that occasionally run twice or get skipped.
Give the conclusion and impact scope first, then only the changed snippets (no full files), and finally one check that proves it works. Flag risky spots separately.
Reconciliation runs at 3am daily; it ran twice recently. Using Laravel schedule plus cron on a single machine.
Not saying how many machines are deployed, so the locking scheme is wrong Ignoring timeouts, so runs overlap No compensation, so a missed run loses data
If problems remain after the fix, paste the new error and the changed snippet back; keep debugging on the original approach, don't switch approaches and rewrite.
More like this: Writing code prompts · All prompts