Skip to content

Feat/time#362

Merged
A6dulmalik merged 5 commits intoMindBlockLabs:mainfrom
nafiuishaaq:feat/time
Mar 26, 2026
Merged

Feat/time#362
A6dulmalik merged 5 commits intoMindBlockLabs:mainfrom
nafiuishaaq:feat/time

Conversation

@nafiuishaaq
Copy link
Copy Markdown
Contributor

Added the advanced middleware package in the middleware workspace for both timeout protection and circuit breaking. The timeout middleware/module is in timeout.middleware.ts (line 1), and the breaker state machine, middleware, and registration module are in circuit-breaker.middleware.ts (line 1). The breaker now supports configurable failure threshold, rolling failure window, half-open retry interval, CLOSED -> OPEN -> HALF_OPEN transitions, and exposes state via getState() / getSnapshot() on CircuitBreakerService.

I also exported the new advanced middleware surface through middleware/src/index.ts (line 1) and added state-machine coverage in circuit-breaker.middleware.spec.ts (line 1) plus timeout behavior checks in timeout.middleware.spec.ts (line 1). Those tests cover:

timed-out requests producing 503
circuit opening after the configured number of failures
OPEN -> HALF_OPEN
HALF_OPEN -> CLOSED on success
HALF_OPEN -> OPEN on failure

CLoses #355

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

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

@A6dulmalik A6dulmalik merged commit 2dea0de into MindBlockLabs:main Mar 26, 2026
3 of 6 checks passed
@A6dulmalik A6dulmalik mentioned this pull request Mar 26, 2026
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.

Middleware Timeout & Circuit Breaker

2 participants