Skip to content

Conversation

@plutopulp
Copy link
Owner

Summary

  • Add retry_handler parameter to DownloadManager for centralized retry configuration
  • Wire retry handler through WorkerPool to all workers
  • Remove dead code FileConfig.max_retries (was never used)
  • Wire retry handler's emitter to manager's shared emitter for unified event flow

Changes

  • DownloadManager: accepts optional retry_handler, wires emitter
  • WorkerPool: accepts and passes retry_handler to worker factory
  • WorkerFactory: protocol updated with retry_handler parameter
  • FileConfig: removed unused max_retries field
  • New integration tests in tests/integration/test_retry.py
  • New example 07_retry_handling.py demonstrating retry patterns
  • Updated docs (README.md, ARCHITECTURE.md)

Add integration tests for retry handler wiring through DownloadManager. Tests verify retry count, event emission, custom policies, and default (no retry) behaviour. Tests will fail until manager accepts retry_handler parameter.
The field was never wired through to workers. Retry configuration will be manager-level only.
Updates WorkerFactory protocol to accept an optional retry handler, threads it through WorkerPool (including test fixtures) so workers receive the configured handler.
DownloadManager now accepts optional retry_handler and passes it through to WorkerPool. Users can enable retries via DownloadManager(retry_handler=RetryHandler(RetryConfig(...))). Integration tests now pass.
- Update ARCHITECTURE.md with retry_handler in DownloadManager and WorkerPool
- Update README.md retry section to show manager-level configuration
- Remove outdated note about retry requiring direct worker instantiation
- Add custom retry handler example for advanced scenarios
Demonstrates manager-level retry handler injection with:
- Basic retry handler with exponential backoff
- Custom retry policy (treating 404 as transient)
- RETRYING event subscription for observability
- Comparison with no-retry default behaviour

Uses httpbin.org/status/* endpoints to reliably trigger retries.
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@plutopulp plutopulp merged commit 408238b into main Dec 17, 2025
5 checks passed
@plutopulp plutopulp deleted the retry-configurations branch December 17, 2025 14:26
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.

3 participants