Skip to content

feat: retry before recreating grpc client#182

Merged
linkouth merged 4 commits into
mainfrom
feat/retry-before-recreating-grpc-client
Jul 3, 2026
Merged

feat: retry before recreating grpc client#182
linkouth merged 4 commits into
mainfrom
feat/retry-before-recreating-grpc-client

Conversation

@linkouth

@linkouth linkouth commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Adjust gRPC retry behavior to prefer retrying over client recreation for retryable errors and expand the set of retryable gRPC status codes.

Bug Fixes:

  • Prevent unnecessary gRPC client recreation when a request should instead be retried for retryable errors.

Enhancements:

  • Treat DEADLINE_EXCEEDED as a retryable gRPC status code to align retry logic with expected transient error handling.

@sourcery-ai

sourcery-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts gRPC retry behavior so that the client is only re-created when a request should not be retried, and expands the set of retryable status codes to include DEADLINE_EXCEEDED.

File-Level Changes

Change Details Files
Refine logic for when to recreate the gRPC service client versus retrying a call.
  • Guard the service recreation condition with a check that the request is not eligible for retry
  • Maintain existing logging when the service client is re-created
lib/components/grpc.ts
Align retryable status codes with gRPC semantics.
  • Add DEADLINE_EXCEEDED to the list of retryable gRPC status codes
lib/constants.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The interplay between shouldRetry and shouldRecreateService is now implicit; consider extracting a small helper or adding a clear precedence rule (e.g., retry takes priority over recreate) to keep this behavior easy to reason about and avoid future regressions.
  • Now that DEADLINE_EXCEEDED is added to RETRYABLE_STATUS_CODES, check whether it overlaps with any codes that also trigger service recreation and, if so, centralize that mapping to avoid diverging retry/recreate behavior for the same status.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The interplay between `shouldRetry` and `shouldRecreateService` is now implicit; consider extracting a small helper or adding a clear precedence rule (e.g., retry takes priority over recreate) to keep this behavior easy to reason about and avoid future regressions.
- Now that `DEADLINE_EXCEEDED` is added to `RETRYABLE_STATUS_CODES`, check whether it overlaps with any codes that also trigger service recreation and, if so, centralize that mapping to avoid diverging retry/recreate behavior for the same status.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@linkouth linkouth changed the title Feat/retry before recreating grpc client feat: retry before recreating grpc client Jul 3, 2026
@linkouth
linkouth merged commit 6812cdb into main Jul 3, 2026
8 of 11 checks passed
@linkouth
linkouth deleted the feat/retry-before-recreating-grpc-client branch July 3, 2026 10:12
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