Skip to content

Conversation

a-klos
Copy link
Member

@a-klos a-klos commented Sep 2, 2025

This pull request introduces a robust, configurable retry decorator with exponential backoff and rate-limit handling for both synchronous and asynchronous functions. It also integrates the retry decorator settings into the infrastructure configuration, making them easily adjustable via environment variables and Kubernetes ConfigMaps. Comprehensive tests have been added to ensure correct behavior. The main changes are grouped below:

Retry Decorator Implementation and Utilities

  • Added retry_with_backoff decorator in libs/rag-core-lib/src/rag_core_lib/impl/utils/retry_decorator.py, supporting configurable retries, exponential backoff, jitter, and rate-limit awareness for sync/async functions.
  • Introduced utility functions in libs/rag-core-lib/src/rag_core_lib/impl/utils/utils.py for parsing rate-limit headers, normalizing dictionaries, and extracting status codes/headers from exceptions.

Configuration and Infrastructure Integration

  • Created RetryDecoratorSettings in libs/rag-core-lib/src/rag_core_lib/impl/settings/retry_decorator_settings.py using Pydantic, allowing environment-based configuration of retry logic parameters.
  • Added retryDecorator configuration block to infrastructure/rag/values.yaml for setting retry parameters via Helm values.
  • Generated a new ConfigMap in infrastructure/rag/templates/configmap.yaml to expose retry decorator settings to Kubernetes deployments.
  • Updated deployment templates (admin-backend/deployment.yaml, backend/deployment.yaml) to mount the new retry decorator ConfigMap. [1] [2]
  • Added a Helm template helper for naming the retry decorator ConfigMap in _helpers.tpl.

Testing

  • Added comprehensive unit tests in libs/rag-core-lib/tests/retry_decorator_test.py to validate retry logic, rate-limit handling, and configuration.

This PR covers the following feature request
#87

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