Skip to content

Add retry configuration for asyncio #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2025

Conversation

jhamon
Copy link
Collaborator

@jhamon jhamon commented May 16, 2025

Problem

We want to use exponential backoff to retry failed requests made via PineconeAsyncio

Solution

  • Add aiohttp-retry dependency without the asyncio extras group
  • Implement a JitterRetry class to calculate backoff intervals
    • The off-the-shelf JitteryRetry class has some odd behavior so i wanted to implement my own. This helps keep the behavior close to what we're doing for urllib3.
    • Intervals are roughly 0.1, 0.2, 0.4, 0.8 seconds (plus small jitter factor)
  • Manual testing with test server in scripts/test-server.py and scripts/test-async-retry.py

Type of Change

  • New feature (non-breaking change which adds functionality)

Test Plan

Added some scripts for manual testing

@jhamon jhamon marked this pull request as ready for review May 16, 2025 17:54


async def main():
async with PineconeAsyncio(host="http://localhost:8000") as pc:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there also a scripts/test-server.py file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already in. It got committed in a previous diff for urllib3 retries.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, was checking main not the branch 🤦‍♂️

@jhamon jhamon merged commit dd4306e into release-candidate/2025-04 May 16, 2025
72 checks passed
@jhamon jhamon deleted the jhamon/aiohttp-retries branch May 16, 2025 18:30
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.

2 participants