mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 00:03:23 +00:00
Race Condition Fixes (jobScheduler.ts): - Implement optimistic job creation with graceful fallback - Minimize race condition window by trying create first, then check - Add enhanced error detection for constraint violations - Provide detailed error context for debugging data consistency issues Error Handling Improvements (sendEmail.ts): - Distinguish between POLLING_TIMEOUT vs JOB_NOT_FOUND errors - Add specific error types for programmatic handling - Provide actionable troubleshooting steps in error messages - Include recovery instructions (processEmailById fallback) Benefits: - Eliminates the check-then-create race condition vulnerability - Provides clear error classification for different failure modes - Enables better monitoring and debugging of job scheduling issues - Maintains robustness under high concurrency scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>