Skip to content
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

Fix Async Retry Event Handling #8659

Merged
merged 2 commits into from Aug 3, 2023
Merged

Fix Async Retry Event Handling #8659

merged 2 commits into from Aug 3, 2023

Conversation

hinthornw
Copy link
Collaborator

@hinthornw hinthornw commented Aug 3, 2023

It fails currently because the event loop is already running.

The retry decorator alraedy infers an AsyncRetrying handler for coroutines (see tenacity line) However before_sleep always gets called synchronously (see tenacity line).

Instead, check for a running loop and use that it exists. Of course, it's running an async method synchronously which is not nice. Given how important LLMs are, it may make sense to have a task list or something but I'd want to chat with @nfcampos on where that would live.

This PR also fixes the unit tests to check the handler is called and to make sure the async test is run (it looks like it's just been being skipped). It would have failed prior to the proposed fixes but passes now.

@vercel
Copy link

vercel bot commented Aug 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Aug 3, 2023 3:10pm

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Aug 3, 2023
@hinthornw hinthornw requested a review from nfcampos August 3, 2023 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant