Skip to content

#437 [BE-API-083] Backend API Performance Enhancement and Storage - Step 83#678

Merged
soomtochukwu merged 1 commit into
DXmakers:mainfrom
A5cend-dev:main
Jun 1, 2026
Merged

#437 [BE-API-083] Backend API Performance Enhancement and Storage - Step 83#678
soomtochukwu merged 1 commit into
DXmakers:mainfrom
A5cend-dev:main

Conversation

@A5cend-dev

Copy link
Copy Markdown
Contributor

BE-API-083: Configure Async Processing Queue for Dispute File Analysis

Summary

Implements a bounded async queue and worker pool for processing dispute file attachments in the background. File uploads return immediately (202 Accepted) while analysis runs off the request path.

Changes

  • queue/DisputeAnalysisTask type, AnalysisStatus enum, and a worker pool with exponential back-off retries (max 3 attempts)
  • routes/disputes.rsPOST /api/v1/disputes/:id/files (enqueue), GET /api/v1/disputes/:id/files (list), GET /api/v1/disputes/:id/files/:file_id (result), GET /api/v1/disputes/queue/stats
  • db/disputes.rs — SQLx queries with paginated list via covering index on (dispute_id, enqueued_at DESC)
  • migrations/analysis_status enum, dispute_file_analyses table, 3 indexes, stale-task recovery function
  • main.rs — pool tuning via env vars, worker pool startup, full middleware stack (tracing, timeout, CORS, request-id)

Acceptance Criteria

  • Endpoints return standard HTTP status codes (202, 200, 400, 404, 503)
  • DB pool capped via DB_MAX_CONNECTIONS; validated under 50 concurrent queries in integration test
  • Bounded channel enforces back-pressure — no unbounded task spawning
  • All handlers instrumented with tracing::instrument spans

Testing

cargo test -p backend
cargo test --test dispute_queue_integration

Closes #437

@A5cend-dev A5cend-dev requested a review from soomtochukwu as a code owner June 1, 2026 20:19
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@A5cend-dev is attempting to deploy a commit to the mAzI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 1, 2026

Copy link
Copy Markdown

@A5cend-dev 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! 🚀

Learn more about application limits

@soomtochukwu soomtochukwu merged commit 91a9ed2 into DXmakers:main Jun 1, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BE-API-083] Backend API Performance Enhancement and Storage - Step 83

2 participants