Skip to content

feat(http): add pooled HTTP client with timeout budgets for third-par…#1850

Merged
RUKAYAT-CODER merged 3 commits into
EarnQuestOne:mainfrom
emteebug12-jpg:be-126/pooled-http-client
Jul 2, 2026
Merged

feat(http): add pooled HTTP client with timeout budgets for third-par…#1850
RUKAYAT-CODER merged 3 commits into
EarnQuestOne:mainfrom
emteebug12-jpg:be-126/pooled-http-client

Conversation

@emteebug12-jpg

Copy link
Copy Markdown
Contributor

…ty integrations

Introduces PooledHttpClientService (HttpClientModule) backed by keep-alive http/https agents (maxSockets=50) and three named timeout budgets:
short 3 s – health checks (Stellar Horizon, SendGrid)
medium 8 s – moderation API, webhook delivery
long 15 s – GitHub API (dependency freshness)

Registers the module globally in AppModule and migrates ExternalModerationApiService, WebhookChannel, ExternalHealthService, and DependencyFreshnessService off ad-hoc axios calls onto the shared client. Adds 12 unit tests covering budget timeouts, agent reuse, and teardown.

Closes #1153

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@emteebug12-jpg 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

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Great job so far

There are just two blockers — the workflow is failing and the merge conflict. Could you take a look and fix it so all checks pass?
You could pull from the main to get the changes before pushing.

emteebug12-jpg and others added 2 commits July 1, 2026 11:43
…ty integrations

Introduces PooledHttpClientService (HttpClientModule) backed by keep-alive
http/https agents (maxSockets=50) and three named timeout budgets:
  short 3 s  – health checks (Stellar Horizon, SendGrid)
  medium 8 s – moderation API, webhook delivery
  long  15 s – GitHub API (dependency freshness)

Registers the module globally in AppModule and migrates
ExternalModerationApiService, WebhookChannel, ExternalHealthService, and
DependencyFreshnessService off ad-hoc axios calls onto the shared client.
Adds 12 unit tests covering budget timeouts, agent reuse, and teardown.

Closes EarnQuestOne#1153

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dule, ModerationModule

@global() only propagates when AppModule is the root — integration tests that
bootstrap individual modules in isolation need the import directly on each module
that provides a service depending on PooledHttpClientService.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@emteebug12-jpg emteebug12-jpg force-pushed the be-126/pooled-http-client branch from b009e58 to 43663bc Compare July 1, 2026 10:44
@emteebug12-jpg

Copy link
Copy Markdown
Contributor Author

Updates pushed

Rebased onto latest main and fixed the integration test failures.

Root cause: @Global() only propagates when AppModule is the root context. Integration tests that bootstrap individual modules in isolation (e.g. UsersModule → EmailModule → JobsModule) never load AppModule, so PooledHttpClientService was unresolvable for DependencyFreshnessService.

Fix: Added HttpClientModule explicitly to the imports of each module that owns a service depending on PooledHttpClientService:

  • JobsModuleDependencyFreshnessService
  • HealthModuleExternalHealthService
  • ModerationModuleExternalModerationApiService

Merge conflict: Upstream added FileUploadModule to app.module.ts in the same spot we added HttpClientModule. Resolved by keeping both, then rebased cleanly onto upstream/main.

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

You are almost there just update the Backend Module Changelog

Adds [Unreleased] entries to jobs, health, moderation, and notifications
module changelogs describing the migration to PooledHttpClientService.
Creates a new CHANGELOG for the http-client common module documenting
the initial addition of PooledHttpClientService and HttpClientModule.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@emteebug12-jpg

Copy link
Copy Markdown
Contributor Author

Changelog updated

Added [Unreleased] entries to all affected module changelogs:

  • src/common/http-client/CHANGELOG.md (new) — documents PooledHttpClientService, HttpClientModule, and the three timeout budgets
  • src/modules/jobs/CHANGELOG.mdDependencyFreshnessService migrated to long (15 s) budget
  • src/modules/health/CHANGELOG.mdExternalHealthService migrated to short (3 s) budget
  • src/modules/moderation/CHANGELOG.mdExternalModerationApiService migrated to medium (8 s) budget
  • src/modules/notifications/CHANGELOG.mdWebhookChannel migrated to medium (8 s) budget (was previously unbounded)

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 0f4d978 into EarnQuestOne:main Jul 2, 2026
8 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-126] Add pooled HTTP client for third-party integrations with timeout budgets

2 participants