feat: add resilient background job retry & monitoring#598
Closed
Islam0953 wants to merge 2 commits intorohitdash08:mainfrom
Closed
feat: add resilient background job retry & monitoring#598Islam0953 wants to merge 2 commits intorohitdash08:mainfrom
Islam0953 wants to merge 2 commits intorohitdash08:mainfrom
Conversation
🎯 Claiming this Bounty!Plan:
💰 Payment InformationPayment: $250 USD Quality Commitment:
Let's build this! ⚙️ |
💰 Payment Information (补充)PayPal: 979749654@qq.com
|
💰 Payment InformationPayPal: 979749654@qq.com
|
Dlove123
added a commit
to Dlove123/FinMind
that referenced
this pull request
Mar 22, 2026
- Retry logic with max attempts - Monitoring dashboard - 2 unit tests (100% pass) - Code review completed 💰 Payment: PayPal + ETH + SOL + RTC (50)
4572131 to
2a54563
Compare
- Service: job_retry module with exponential backoff, configurable max_retries/base_delay/backoff_factor, thread-safe execution - Models: BackgroundJob (6 states: pending/running/success/failed/retrying/dead) and JobHistory for per-attempt tracking - Dead letter queue for permanently failed jobs - Decorator pattern (@resilient_job) for retrofitting existing functions - Monitoring API: /jobs/stats, /jobs (list+filter), /jobs/<id> (with history), /jobs/dead-letter, /jobs/<id>/retry (manual), /jobs/<id> DELETE - Database: background_jobs and job_history tables with indexes - Tests: 17 tests covering service (create, success, retry exhaustion, retry-then-succeed, history, stats, dead letter, decorator) and API (stats, list, filter, get, retry, delete, history) Resolves rohitdash08#130 /claim rohitdash08#130
…nd expanded tests - Validate and sanitize job names (reject empty, trim, truncate to 200 chars) - Clamp max_retries to [1, 20], base_delay to [0, 300s], backoff_factor to [1, 10] - Add max_delay parameter to cap exponential backoff and prevent unbounded sleeps - Truncate result (10k) and error (5k) fields to prevent unbounded DB storage - Rename _job_to_dict to job_to_dict (public API, was imported across modules) - Remove unused threading.Lock and traceback imports - Add status validation on list endpoint (reject invalid filter values) - Record MANUAL_RETRY history entry on manual retry for audit trail - Add logging on job deletion - Expose backoff_factor and max_delay on @resilient_job decorator - Add docstrings to all public functions - Expand test suite from 18 to 41 tests: input clamping, truncation, args passthrough, history on success, dead-letter limits, retry eligibility, invalid status filter, pagination, unauthenticated access, and more - Replace global mutable _call_count with closure-based test helper
a82035c to
c6dc968
Compare
Author
|
Closing - no longer pursuing this contribution. |
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
max_retries,base_delay,backoff_factorBackgroundJobmodel with 6 states: PENDING, RUNNING, SUCCESS, FAILED, RETRYING, DEADJobHistorymodel for per-attempt tracking@resilient_jobdecorator for retrofitting existing functionsGET /jobs/stats— job statistics by statusGET /jobs— list jobs with status filter & paginationGET /jobs/<id>— job details with full attempt historyGET /jobs/dead-letter— dead letter queuePOST /jobs/<id>/retry— manual retry for dead/failed jobsDELETE /jobs/<id>— remove job recordbackground_jobsandjob_historytables with indexesTest plan
/claim #130
https://claude.ai/code/session_01K5UYcnS3skK6SKhFz3dcZs