Skip to content

Phase 8.1: Implement Timeout Policies and Resilience Testing#154

Merged
artcava merged 12 commits intodevelopfrom
feature/issue-109-timeout-policies-resilience-testing
Mar 4, 2026
Merged

Phase 8.1: Implement Timeout Policies and Resilience Testing#154
artcava merged 12 commits intodevelopfrom
feature/issue-109-timeout-policies-resilience-testing

Conversation

@artcava
Copy link
Copy Markdown
Owner

@artcava artcava commented Mar 3, 2026

Description

Implements comprehensive timeout policies and resilience testing for Phase 8.1.

Changes

Core Implementation

  • TimeoutConfiguration with configurable timeout values
  • TimeoutPolicyFactory for creating timeout policies
  • Extended ResiliencePolicyWrapper with complete policies (timeout + circuit breaker + retry)
  • Updated configuration and DI registration

Testing

  • Integration tests for all policy interactions
  • Chaos tests with 5 failure scenarios
  • Performance benchmarks with BenchmarkDotNet

Documentation

  • Comprehensive RESILIENCE-STRATEGY.md

Policy Wrapping Order

Timeout (outer) → Circuit Breaker → Retry (inner) → Operation

Acceptance Criteria

  • TimeoutConfiguration implemented
  • TimeoutPolicyFactory created
  • Complete resilience policies with timeout
  • Configuration updated
  • Integration tests
  • Chaos tests
  • Performance tests
  • Documentation

Closes #109

artcava and others added 12 commits March 3, 2026 14:03
- Add configurable timeout values for HTTP, database, and broker operations
- Support pessimistic and optimistic timeout strategies
- Provide TimeSpan properties for easy policy integration

Related to #109
- Create timeout policies for HTTP, database, and broker operations
- Support both pessimistic and optimistic timeout strategies
- Add comprehensive logging for timeout events
- Include timeout duration and strategy in logs

Related to #109
- Add CreateCompleteHttpResiliencePolicy with timeout + circuit breaker + retry
- Add CreateCompleteDatabaseResiliencePolicy with full policy stack
- Add CreateCompleteBrokerResiliencePolicy with timeout support
- Maintain existing two-layer policies for backward compatibility
- Wrap policies in correct order: Timeout (outer) -> Circuit Breaker -> Retry (inner)

Related to #109
- Add Resilience:Timeout section with HTTP, database, and broker timeouts
- Configure pessimistic timeout strategy as default
- Set appropriate timeout values: HTTP 30s, Database 10s, Broker 5s

Related to #109
- Register TimeoutConfiguration from appsettings
- Add complete wrapped policies with timeout + circuit breaker + retry
- Maintain backward compatibility with existing two-layer policies
- Update HTTP resilience policy factory to support complete policies

Related to #109
- Add tests for retry on transient failures
- Add tests for circuit breaker opening after threshold
- Add tests for timeout on slow operations
- Add tests for combined policy interaction
- Use WebApplicationFactory for integration testing

Related to #109
- Add database intermittent failures scenario (30% failure rate)
- Add database prolonged outage scenario
- Add broker slow responses scenario
- Add network partition simulation
- Add high load with varying failure rates
- Measure success rates and performance impact

Related to #109
- Add baseline benchmark without policies
- Add benchmarks for individual policies (retry, circuit breaker, timeout)
- Add benchmark for complete policy stack
- Use BenchmarkDotNet with memory diagnostics
- Measure overhead for each resilience layer

Related to #109
- Document all implemented resilience policies
- Explain timeout, retry, and circuit breaker patterns
- Describe policy combination and wrapping order
- Provide configuration examples
- Add monitoring and health check information
- Include testing strategy overview

Related to #109
- For HTTP, wrap timeout with ExecuteAsync delegate pattern
- Use Policy.WrapAsync only for typed policies (circuit breaker + retry)
- Apply timeout as outer wrapper around the wrapped policy
- Maintain correct wrapping order: timeout -> circuit breaker -> retry

Fixes build error CS1503
- Register CompleteHttpResiliencePolicy instead of AsyncPolicyWrap<HttpResponseMessage>
- Update factory to return the new wrapper type
- Maintain correct usage pattern for HTTP resilience with timeout

Related to #109
@artcava artcava merged commit 27942de into develop Mar 4, 2026
4 checks passed
@artcava artcava deleted the feature/issue-109-timeout-policies-resilience-testing branch March 4, 2026 08:08
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.

1 participant