Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Fix Tenacity Retry Logic#298

Merged
mrkaye97 merged 5 commits intomainfrom
fix--tenacity-errors
Jan 16, 2025
Merged

Fix Tenacity Retry Logic#298
mrkaye97 merged 5 commits intomainfrom
fix--tenacity-errors

Conversation

@mrkaye97
Copy link
Contributor

@mrkaye97 mrkaye97 commented Jan 16, 2025

Review with whitespace hidden, the diff is much smaller than GH thinks

Fixing Tenacity logic for retries here - there were a couple of issues:

  1. It's not super clear to me when grpc will raise a grpc.RpcError vs when it will raise grpc.aio.AioRpcError (I'd think that when using aio methods it'd raise an aio error, but from local testing that appears to not be the case. So I just am catching both cases everywhere for now.
  2. We were catching these RPC errors and re-raising value errors in a number of places, which would cause the isinstance(ex, (grpc.aio.AioRpcError, grpc.RpcError)) check to fail, making the errors fall through and not be retried. In those cases, I removed the error handling in the function that had retries enabled (cc @grutt lmk if there's a reason I'm missing for doing this - want to make sure I'm not breaking something unintentionally)
  3. ex.code is a method, so the if ex.code in [...] check would always be falsy regardless of the code, so I fixed that

Copy link
Contributor

@abelanger5 abelanger5 left a comment

Choose a reason for hiding this comment

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

Looks great 👍

Copy link
Contributor

@grutt grutt left a comment

Choose a reason for hiding this comment

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

Not sure why we were doing this... I'm in favor of removing.

@mrkaye97 mrkaye97 merged commit 3d78307 into main Jan 16, 2025
6 checks passed
@mrkaye97 mrkaye97 deleted the fix--tenacity-errors branch January 16, 2025 22:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants