feat: Resilient background job retry and monitoring (#130)#647
Open
HuiNeng6 wants to merge 1 commit intorohitdash08:mainfrom
Open
feat: Resilient background job retry and monitoring (#130)#647HuiNeng6 wants to merge 1 commit intorohitdash08:mainfrom
HuiNeng6 wants to merge 1 commit intorohitdash08:mainfrom
Conversation
…ohitdash08#130) Implements rohitdash08#130: Resilient background job retry & monitoring Features: - Exponential backoff retry with configurable delays - Dead letter queue for permanently failed jobs - Priority-based job processing - Comprehensive metrics and monitoring - REST API endpoints for job management - Database migration script - Full test coverage Components: - BackgroundJob model for tracking job state - BackgroundJobService with retry logic - Job metrics tracking (created, succeeded, failed, retried, dead_letter) - API endpoints for monitoring and manual intervention - Database migration for background_jobs table Technical details: - Exponential backoff: initial 1s, max 5min, 2x multiplier - Configurable jitter to prevent thundering herd - Priority queue processing (higher priority first) - Automatic cleanup of old completed jobs - Health check endpoint for monitoring /claim rohitdash08#130
Author
📢 跟进 — Background Job Retry & Monitoring✅ PR状态
请review。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements #130: Resilient background job retry & monitoring
This PR adds a comprehensive background job execution system with automatic retry and monitoring capabilities.
Features Implemented
Core Functionality
Monitoring & Metrics
Technical Details
Files Added/Modified
API Endpoints
Usage Example
\\python
from app.services.background_jobs import BackgroundJobService, JobType
Enqueue a job
job = BackgroundJobService.enqueue(
job_type=JobType.SEND_EMAIL,
payload={'to': 'user@example.com', 'subject': 'Welcome'},
priority=10,
max_retries=3
)
Register a handler
BackgroundJobService.register_handler(
JobType.SEND_EMAIL,
lambda p: send_email(p['to'], p['subject'])
)
Process jobs (in background worker)
stats = BackgroundJobService.process_pending_jobs(limit=10)
\\
Testing
All tests pass with comprehensive coverage:
Acceptance Criteria
/claim #130