Fix critical race conditions and performance issues

- Implement atomic check-and-create pattern in ensureEmailJob with exponential backoff
- Fix import mismatch by exporting processJobById from index.ts
- Enable database indexes for status+scheduledAt and priority+createdAt fields
- Standardize string conversion for consistent ID handling throughout codebase
- Fix TypeScript compilation errors in collection indexes and variable scope

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-14 21:35:27 +02:00
parent 4680f3303e
commit e28ee6b358
4 changed files with 88 additions and 58 deletions

View File

@@ -9,6 +9,10 @@ export interface ProcessEmailJobInput {
* The ID of the email to process
*/
emailId: string | number
/**
* Optional unique constraint helper to prevent duplicate jobs
*/
uniqueKey?: string
}
/**