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: Retry worker on runtime errors #512

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions agents-api/agents_api/worker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

import asyncio

from tenacity import retry, retry_if_exception_type, wait_fixed

from ..clients import temporal
from .worker import create_worker


@retry(wait=wait_fixed(20), retry=retry_if_exception_type(RuntimeError))
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a stop condition to the retry decorator to prevent infinite retries. For example, you can use stop=stop_after_attempt(n) to limit the number of retries.

async def main():
"""
Initializes the Temporal client and worker with TLS configuration (if provided),
Expand Down
Loading