{"success":true,"results":[{"id":"doc:765c5f89e560a58bc58d86c755ae1e383045c221","type":"doc","url":"https://github.com/thomhurst/modularpipelines/blob/7f03f8e97ef0ca64011794c7bb28f7a964df1e48/docs/versioned_docs/version-3.x/how-to/retry-policy.md","title":"Retry Policies","passages":[{"text":"# Retry Policies\n## Using ModuleConfiguration\n### Simple Retry Count\nThe easiest way to add retries is with `WithRetryCount()`:\n\n```csharp\npublic class MyModule : Module<CommandResult>\n{\n    protected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n        .WithRetryCount(3)  // Retry up to 3 times with exponential backoff\n        .Build();\n\n    protected override async Task<CommandResult?> ExecuteAsync(IModuleContext context, CancellationToken cancellationToken)\n    {\n        // Do something that might fail transiently\n    }\n}\n```\n\n### Custom Polly Policy\n```csharp\npublic class MyModule : Module<CommandResult>\n{\n    protected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n        .WithRetryPolicy(\n            Policy.Handle<HttpRequestException>()\n                .WaitAndRetryAsync(5, i => TimeSpan.FromSeconds(i * i)))\n        .Build();\n\n    protected override async Task<CommandResult?> ExecuteAsync(IModuleContext context, CancellationToken cancellationToken)\n    {\n        // Do something\n    }\n}\n```\n\n## Combining with Other Behaviors\n```csharp\npublic class ResilientModule : Module<CommandResult>\n{\n    protected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n        .WithRetryCount(3)\n        .WithTimeout(TimeSpan.FromMinutes(10))\n        .WithIgnoreFailures()  // Don't fail the pipeline even after all retries\n        .Build();\n}\n```","textKind":"highlight"}]},{"id":"issue:subzeroid/instagrapi#2184","type":"issue","url":"https://github.com/subzeroid/instagrapi/issues/2184","title":"Is there any client method to configure number of retries for both public and private requests?#2184","passages":[{"text":"# Is there any client method to configure number of retries for both public and private requests?#2184\n## Description\nYou can configure it either at client creation time or later via `set_retry_config(...)`:\n\n```\nfrom instagrapi import Client\n\ncl = Client(\n    request_timeout=0,\n    public_request_retries_count=4,\n    public_request_retries_timeout=1,\n    session_retry_total=5,\n    session_retry_backoff_factor=1,\n)\n\ncl.set_retry_config(\n    request_timeout=0,\n    public_request_retries_count=2,\n    public_request_retries_timeout=0,\n    session_retry_total=3,\n    session_retry_backoff_factor=1,\n    session_retry_statuses=[429, 500, 502, 503, 504],\n)\n```\n\n- `docker compose run --rm --entrypoint python devbox -m unittest tests.ClientTestCase.test_set_retry_config_updates_settings_and_session_adapters tests.ClientTestCase.test_settings_round_trip_preserves_retry_config tests.ClientTestCase.test_public_request_uses_client_retry_defaults`\n- `docker compose run --rm --entrypoint mkdocs mkdocs build --strict`","textKind":"highlight"}]},{"id":"readme:nfedyashev/retryable","type":"readme","url":"https://github.com/nfedyashev/retryable","title":"nfedyashev/retryable","passages":[{"text":"# Retryable\n## Installation\n```ruby\ngem 'retryable'\n```\n\n## Defaults\n```ruby\nRetryable.configure do |config|\n  config.contexts     = {}\n  config.ensure       = proc {}\n  config.exception_cb = proc {}\n  config.log_method   = proc {}\n  config.matching     = /.*/\n  config.not          = []\n  config.on           = StandardError\n  config.sleep        = 1\n  config.sleep_method = lambda { |n| Kernel.sleep(n) }\n  config.tries        = 2\nend\n```\n\n## Block Parameters\n```ruby\nRetryable.retryable do |retries, exception|\n  puts \"try #{retries} failed with exception: #{exception}\" if retries > 0\n  # code here\nend\n```\n\n## Logging\n```ruby\nlog_method = lambda do |retries, exception|\n  Rails.logger.debug(\"[Attempt ##{retries}] Retrying because [#{exception.class} - #{exception.message}]: #{exception.backtrace.first(5).join(' | ')}\")\nend\n```\n\n## Contexts\n```ruby\nRetryable.configure do |config|\n  config.contexts[:faulty_service] = {\n    on: [FaultyServiceTimeoutError],\n    sleep: 10,\n    tries: 5\n  }\nend\n\n\nRetryable.with_context(:faulty_service) {\n  # code here\n}\n```\n\n## Specify exceptions where a retry should NOT be performed\n```ruby\nclass MyError < StandardError; end\n\nRetryable.retryable(tries: 5, on: [StandardError], not: [MyError]) do\n  raise MyError \"No retries!\"\nend\n```","textKind":"highlight","citation_url":"https://raw.githubusercontent.com/nfedyashev/retryable/HEAD/README.md"}]},{"id":"doc:6bc9a3310d3e79ca2cd27a29305c7a5ba9134765","type":"doc","url":"https://github.com/567-labs/instructor/blob/500fa020e5205cb68f1fc53c8a5b78c4388a263b/docs/faq.md","title":"Frequently Asked Questions","passages":[{"text":"# Frequently Asked Questions\n## Common Issues\n### How do I handle validation errors?\n```python\nfrom tenacity import stop_after_attempt\n\nresult = client.create(\n    response_model=MyModel,\n    max_retries=stop_after_attempt(5),  # Retry up to 5 times\n    messages=[...]\n)\n```\n\n## Performance and Costs\n### How do I handle rate limits?\nInstructor uses the `tenacity` library for retries, which you can configure:\n\n```python\nfrom tenacity import retry_if_exception_type, wait_exponential\nfrom openai.error import RateLimitError\n\nresult = client.create(\n    response_model=MyModel,\n    max_retries=retry_if_exception_type(RateLimitError),\n    messages=[...],\n)\n```","textKind":"highlight"}]},{"id":"readme:lostisland/faraday-retry","type":"readme","url":"https://github.com/lostisland/faraday-retry","title":"lostisland/faraday-retry","passages":[{"text":"# Faraday Retry\n## Installation\n```ruby\ngem 'faraday-retry'\n```\n\n## Usage\n### Control when the middleware will retry requests\n#### Specify which methods will be retried\n```ruby\nretry_options = {\n  methods: %i[get post]\n}\n```\n\n#### Specify on which response statuses to retry\n```ruby\nretry_options = {\n  retry_statuses: [401, 409]\n}\n```\n\n#### Automatically handle the `Retry-After` and `RateLimit-Reset` headers\n```ruby\nretry_options = {\n  retry_statuses: [429]\n}\n```\n\n```ruby\nretry_options = {\n  retry_statuses: [429],\n  rate_limit_retry_header: 'x-rate-limit-retry-after',\n  rate_limit_reset_header: 'x-rate-limit-reset',\n  header_parser_block: ->(value) { Time.at(value.to_i).utc - Time.now.utc }\n}\n```\n\n### Call a block on every retry\n```ruby\nresponse_statuses = []\nretry_options = {\n  retry_block: -> (env:, options:, retry_count:, exception:, will_retry_in:) { response_statuses << env.status }\n}\n```","textKind":"highlight","citation_url":"https://raw.githubusercontent.com/lostisland/faraday-retry/HEAD/README.md"}]},{"id":"doc:bc5005840eb9efd47a11366663f7dcae61a741a2","type":"doc","url":"https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/","passages":[{"text":"## [How to configure the amount of retries?](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#how-to-configure-the-amount-of-retries)\n- [Default retry policy configuration](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#default-retry-policy-configuration)\n- [Per Job](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#per-job)\n\n#### [Default retry policy configuration](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#default-retry-policy-configuration)\n```java\nJobRunr.configure()\n    .withJobFilters(new RetryFilter(2))\n    .useBackgroundJobServer(new BackgroundJobServer(...))\n    ....\n```\n\n### [Custom `RetryPolicy` configuration](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#custom-retrypolicy-configuration)\nOr, you need a different retry policy per job or per Exception. Using the custom `RetryPolicy`, you can configure different rules based on the job and the exceptions you encounter. The first rule that matches, will be used.\n\nUsing the `PerJobRetryPolicy`, you now can handle the most exotic business rules where you can define custom rules based on the `Exception` you are encountering, the `JobDetails`, Job labels, … .\n\n#### [A custom `RetryPolicy` for all your jobs](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#a-custom-retrypolicy-for-all-your-jobs)\n```properties\njobrunr.jobs.custom-backoff-retry-policy=5,5,60,120\n```\n\nIn the example above, all your jobs will be retried at most 4 times and the retries will happen after 5 seconds, 5 seconds, 60 seconds and then 120 seconds …\n\n#### [A `DoNotRetryPolicy` in case nothing helps](https://www.jobrunr.io/en/documentation/background-methods/dealing-with-exceptions/#a-donotretrypolicy-in-case-nothing-helps)\nIf you do not want to retry failing jobs, this is also easily configurable:\n\nIf you’re using a framework integration (e.g. `jobrunr-spring-boot-x-starter`, the `jobrunr-micronaut-feature` or the `jobrunr-quarkus-extension`), you just need to define a Bean of type `RetryPolicy` which will be automatically picked up by JobRunr Pro.","textKind":"highlight"}]},{"id":"doc:0f846a9ea37f747136800e81837756ccb5a5e92b","type":"doc","url":"https://github.com/binance/binance-connector-java/blob/32b98a6ca1f5655a15d9a15917e29f28812044f8/clients/w3w-prediction/docs/rest-api/retries.md","title":"Retries Configuration","passages":[{"text":"# Retries Configuration\n```java\n    import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil;\n    import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi;\n    import com.binance.connector.client.common.ApiException;\n    import com.binance.connector.client.common.ApiResponse;\n    import com.binance.connector.client.common.configuration.ClientConfiguration;\n    import com.binance.connector.client.common.configuration.SignatureConfiguration;\n\n    public static void main(String[] args) {\n        ClientConfiguration clientConfiguration = W3WPredictionRestApiUtil.getClientConfiguration();\n        SignatureConfiguration signatureConfiguration = new SignatureConfiguration();\n        signatureConfiguration.setApiKey(\"apiKey\");\n        signatureConfiguration.setPrivateKey(\"path/to/private.key\");\n        clientConfiguration.setSignatureConfiguration(signatureConfiguration);\n\n        // Retry up to 5 times\n        clientConfiguration.setRetries(5);\n        // 500ms between retries\n        clientConfiguration.setBackOff(500);\n\n        W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration);\n    }\n```","textKind":"highlight"}]},{"id":"doc:addf1cc8d543dd36f9b268d2b23ebc5fff41b636","type":"doc","url":"https://github.com/thomhurst/modularpipelines/blob/7f03f8e97ef0ca64011794c7bb28f7a964df1e48/docs/docs/how-to/retry-policy.md","title":"Retry Policies","passages":[{"text":"# Retry Policies\n\nWhen creating modules, you can configure retries per module using the `Configure()` method.\nThe standard API supports exponential backoff, jitter, and exception filtering without exposing\nthe underlying resilience library.\n\n## Using ModuleConfiguration\n\n### Simple Retries\n\nThe easiest way to add retries is with `WithRetry()`:\n\n```csharp\npublic class MyModule : Module<CommandResult>\n{\n    protected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n        .WithRetry(3)  // Retry up to 3 times with exponential backoff and jitter\n        .Build();\n\n    protected override async Task<CommandResult> ExecuteAsync(IModuleContext context, CancellationToken cancellationToken)\n    {\n        // Do something that might fail transiently\n    }\n}\n```\n\nThe default base delay is 100 milliseconds. Each retry uses equal jitter between half and all of\nits exponential-backoff ceiling. You can set a different base delay and limit retries to selected\nexceptions:\n\n```csharp\nprotected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n    .WithRetry(\n        count: 5,\n        baseDelay: TimeSpan.FromSeconds(1),\n        shouldRetry: exception => exception is HttpRequestException)\n    .Build();\n```\n\n### Advanced Polly Policy\n\nFor policy features outside the standard API, use the explicit `.Advanced` surface:\n\n```csharp\npublic class MyModule : Module<CommandResult>\n{\n    protected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n        .Advanced\n        .WithRetryPolicy(\n            Policy.Handle<HttpRequestException>()\n                .WaitAndRetryAsync(5, i => TimeSpan.FromSeconds(i * i)))\n        .Build();\n\n    protected override async Task<CommandResult> ExecuteAsync(IModuleContext context, CancellationToken cancellationToken)\n    {\n        // Do something\n    }\n}\n```\n\n### Context-Aware Retry Policy\n\nIf you need access to the pipeline context when building your policy:\n\n```csharp\npublic class MyModule : Module<CommandResult>\n{\n    protected override ModuleConfiguration Configure() => ModuleConfiguration.Create()\n        .Advanced\n        .WithRetryPolicy(ctx =>\n        {\n            var retryCount = ctx.Environment.IsCI ? 5 : 2;\n            return Policy.Handle<Exception>()\n                .WaitAndRetryAsync(retryCount, i => TimeSpan.FromSeconds(i));\n        })\n        .Build();\n}\n```","textKind":"chunk"}]},{"id":"doc:4421b7657cec53e4eae13fa4dcfe860f7d7bdec8","type":"doc","url":"https://docs.cypress.io/app/guides/test-retries","passages":[{"text":"## Configure Test Retries [​](https://docs.cypress.io/app/guides/test-retries#Configure-Test-Retries)\n### Global Configuration [​](https://docs.cypress.io/app/guides/test-retries#Global-Configuration)\nby passing the `retries` option an object with the following options:\n\n```typescript\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n\n  retries: {\n\n    // Configure retry attempts for `cypress run`\n\n    // Default is 0\n\n    runMode: 2,\n\n    // Configure retry attempts for `cypress open`\n\n    // Default is 0\n\n    openMode: 0,\n\n  },\n\n})\n```\n\n#### Configure retry attempts for all modes [​](https://docs.cypress.io/app/guides/test-retries#Configure-retry-attempts-for-all-modes)\nby defining the `retries` property and setting the desired number of retries.\n\n```js\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n\n  retries: 1,\n\n})\n```\n\n```typescript\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n\n  retries: 1,\n\n})\n```\n\n### Custom Configurations [​](https://docs.cypress.io/app/guides/test-retries#Custom-Configurations)\n#### Individual Test(s) [​](https://docs.cypress.io/app/guides/test-retries#Individual-Tests)\n```jsx\n// Customize retry attempts for an individual test\n\ndescribe('User sign-up and login', () => {\n\n  // `it` test block with no custom configuration\n\n  it('should redirect unauthenticated user to sign-in page', () => {\n\n    // ...\n\n  })\n\n  // `it` test block with custom configuration\n\n  it(\n\n    'allows user to login',\n\n    {\n\n      retries: {\n\n        runMode: 2,\n\n        openMode: 1,\n\n      },\n\n    },\n\n    () => {\n\n      // ...\n\n    }\n\n  )\n\n})\n```\n\n#### Test Suite(s) [​](https://docs.cypress.io/app/guides/test-retries#Test-Suites)\n```jsx\n// Customizing retry attempts for a suite of tests\n\ndescribe(\n\n  'User bank accounts',\n\n  {\n\n    retries: {\n\n      runMode: 2,\n\n      openMode: 1,\n\n    },\n\n  },\n\n  () => {\n\n    // The per-suite configuration is applied to each test\n\n    // If a test fails, it will be retried\n\n    it('allows a user to view their transactions', () => {\n\n      // ...\n\n    })\n\n    it('allows a user to edit their transactions', () => {\n\n      // ...\n\n    })\n\n  }\n\n)\n```","textKind":"highlight"}]},{"id":"doc:3a9941044cc00f71a9b90e6e6dff62b3a0a8accc","type":"doc","url":"https://github.com/bettertyped/hyper-fetch/blob/cd8fbc020f5473d614571026529d50a424f9c3be/documentation/docs/guides/core/01-basics/retries.mdx","title":"Guide - Retries","passages":[{"text":"# Retries\n\nHandling temporary network issues or server errors gracefully is crucial for a robust application. Hyper-fetch provides\na powerful **retries** mechanism that automatically re-sends a request if it fails. This guide will walk you through\nconfiguring and using retries to improve the reliability of your data-fetching logic.\n\n---\n\n:::secondary What you'll learn\n\n1.  How to **enable and configure retries** for a request.\n2.  How to set a **custom delay** between retry attempts.\n3.  The difference between setting retries on **creation vs. dynamically**.\n4.  How to observe retry attempts in **real-time**.\n\n:::\n\n---\n\n## Basic Configuration\n\nYou can configure retries directly on a request using the `retry` and `retryTime` options.\n\n- `retry`: The number of times to re-attempt the request after it fails.\n- `retryTime`: The delay in milliseconds between each retry attempt.\n\nLet's create a request that will fail (by pointing to a non-existent endpoint) and see how retries work.\n\n```tsx\n// We are using non-existent endpoint to showcase the retry mechanism\nconst getUsers = client.createRequest()({\n  method: \"GET\",\n  endpoint: \"/users-fake-endpoint\",\n  // highlight-start\n  retry: 3,\n  retryTime: 1000, // 1 second\n  // highlight-end\n});\n\nconst sendRequest = async () => {\n  const { data, error } = await getUsers.send();\n  console.log({ data, error });\n};\n\nsendRequest();\n```\n\nIn the example above, if the request to `/users-fake-endpoint` fails, Hyper-fetch will automatically retry it up to **3\ntimes**, with a **1-second delay** between each attempt. If all retries fail, the request will finally return an error.\n\n---\n\n## Dynamic Configuration\n\nYou can also configure retries dynamically using the `.setRetry()` and `.setRetryTime()` methods. This is useful when\nyou need to change the retry behavior based on application state or other conditions.\n\nThese methods return a new `Request` instance, leaving the original request unchanged.\n\n```tsx live\nimport { failingRequest } from \"./api\";\n\n// For our example we import request that will fail on purpose\n// We can set retries and retryTime on creation or dynamically\nconst failingRequestWithRetries = failingRequest.setRetry(2).setRetryTime(2000); // 2 seconds\n\nconst { data, error } = await failingRequestWithRetries.send();\nconsole.log({ data, error });\n```\n\nHere, we created a new request `getUsersWithRetries` with 2 retries and a 2-second delay, without modifying the original\n`getUsers` request.\n\n---","textKind":"chunk"}]}],"coverage":{"doc":"ok","issue":"ok","pull_request":"ok","readme":"ok"},"reranked":true}