Skip to content

feat(billing): add graceful timeout on /api/billing with cooperative abort and 504 [b#030] - #1024

Merged
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
emmixeryng:feat/graceful-timeout-billing-b030
Jul 29, 2026
Merged

feat(billing): add graceful timeout on /api/billing with cooperative abort and 504 [b#030]#1024
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
emmixeryng:feat/graceful-timeout-billing-b030

Conversation

@emmixeryng

Copy link
Copy Markdown
Contributor

Description

Add per-request graceful timeout on /api/billing with cooperative abort (via AbortController) and 504 Gateway Timeout on exceed.

Requirements and Context

  • Implemented per the description above
  • Added focused tests for the change
  • Adheres to repo's lint and code style
  • Secure, tested, and documented

Changes

  • src/middleware/timeout.ts — Updated to use standardized error envelope (buildErrorEnvelope) for consistent JSON error format
  • src/routes/billing.ts — Applied createTimeoutMiddleware to all billing routes with configurable timeout
  • src/config/env.ts — Added BILLING_TIMEOUT_MS env var (default: 30s)
  • src/config/index.ts — Exposed billingTimeoutMs in config
  • src/middleware/__tests__/timeout.test.ts — Updated tests to match new envelope format

Related issue

Closes #895

…abort and 504 [b#030]

- Update existing timeout middleware to use standardized error envelope
- Apply timeout middleware to /api/billing routes
- Add BILLING_TIMEOUT_MS env var (default 30s)
- Update timeout tests to match new envelope format
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@emmixeryng 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

@greatest0fallt1me
greatest0fallt1me merged commit 949c85c into CalloraOrg:main Jul 29, 2026
1 check passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Merged into main via admin resolver (-X theirs).

@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Green across the board — merging. Thanks!

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.

Add graceful timeout on /api/billing [b#030]

2 participants