feat: Implement background job queue system#112
Open
precious-akpan wants to merge 11 commits intoFluxora-Org:mainfrom
Open
feat: Implement background job queue system#112precious-akpan wants to merge 11 commits intoFluxora-Org:mainfrom
precious-akpan wants to merge 11 commits intoFluxora-Org:mainfrom
Conversation
Implements a comprehensive background job queue system for handling long-running asynchronous tasks with at-least-once execution semantics, idempotency support, and comprehensive observability. Core Features: - Job submission API with authentication and rate limiting - Job status query API with filtering and pagination - Job cancellation and manual retry endpoints - Worker pool with job polling and execution - Retry engine with exponential backoff and jitter - Rate limiter for abuse prevention - State machine with full history tracking Components: - JobManager: Job lifecycle and state management - Worker: Job execution with timeout enforcement - RetryEngine: Error classification and retry scheduling - RateLimiter: Per-user rate limiting and quota enforcement - Database schema: jobs and job_history tables API Endpoints: - POST /api/jobs - Submit new job - GET /api/jobs/:jobId - Get job status - GET /api/jobs - List jobs with filters - DELETE /api/jobs/:jobId - Cancel job - POST /api/jobs/:jobId/retry - Retry failed job Testing: - 150+ comprehensive tests covering all functionality - Unit tests for all components - Integration tests for API endpoints - All tests passing Requirements Satisfied: - Tasks 1-8 completed (core functionality) - At-least-once execution with idempotency - Durable state management with history - Authentication and authorization - Rate limiting and abuse prevention - Exponential backoff retry logic - Worker pool with concurrent execution - Timeout enforcement with AbortController Related to #[issue-number]
Resolved conflicts in: - package.json: Merged dependencies (express-rate-limit, helmet, pg, proxy-from-env) - package-lock.json: Regenerated after resolving package.json - pnpm-lock.yaml: Removed (using npm) - src/app.ts: Integrated jobs router with new middleware structure - src/db/migrate.ts: Kept PostgreSQL migration approach from main - src/routes/streams.ts: Merged import changes - tests/requestLogger.test.ts: Added vitest import - tests/streams.test.ts: Added jest mock for getStreamById - src/config/stellar.ts: Kept version from main
|
@precious-akpan Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
These internal planning files should not be included in the PR.
Remove internal planning files that should not be in the PR.
- Add lint, lint:fix, format, and format:check scripts to package.json - Add @typescript-eslint/eslint-plugin and @typescript-eslint/parser dependencies - Add @types/ws for WebSocket type definitions - Update eslint.config.js to ignore dist, coverage, and migrations directories - Remove project requirement from eslint parser options to avoid test file issues - Fix unused imports in src/app.ts and src/routes/streams.ts - Prefix unused variables with underscore to follow eslint rules
…ories - Move ignores to a separate config object for proper global ignoring - Add k6 directory to ignores to avoid linting load test scripts - This fixes the parsing error in migrations/1774715131962_streams-table.ts
Contributor
|
@precious-akpan Please resolve the conflicts |
Contributor
|
can you pls merge |
- Add FORBIDDEN to ApiErrorCode enum - Add non-null assertions for user.address in jobs routes - Fix null to undefined in JobManager state updates - Add null check for regex match result in RetryEngine - Add Promise<void> return type to POST /jobs endpoint
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 a comprehensive background job queue system for handling long-running asynchronous tasks.
Changes
Testing
All tests passing:
Related Issue
Closes #41