Skip to content

feat(dart): support per-call retry - #7787

Merged
brianquinlan merged 5 commits into
googleapis:mainfrom
brianquinlan:retry
Oct 28, 2026
Merged

brianquinlan merged 5 commits into
googleapis:mainfrom
brianquinlan:retry

Conversation

@brianquinlan

@brianquinlan brianquinlan commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds a configurable retry parameter to service methods, e.g.,

await someService.someMethod(
  SomeRequest(),
  retry: const ExponentialRetry.onCodes(
    [Code.unavailable, Code.resourceExhausted],
    initialDelay: Duration(milliseconds: 10),
  ),
);

The generated method looks like:

  /// Failed requests are retried using [retry] if provided, and not retried
  /// otherwise.
  Future<void> someMethod(SomeRequest request, {RetryRunner? retry}) async {
    final url = _endPoint.replace(path: '/v2/${request.whatever}');
    await _client.delete(url, retry: retry ?? noRetry);

The reason why the retry is nullable is to make it possible to add service-level retry configuration.

Adds a configurable retry parameter to service methods, e.g.,

```dart
await someService.someMethod(
  SomeRequest(),
  retry: const ExponentialRetry.onCodes(
    [Code.unavailable, Code.resourceExhausted],
    initialDelay: Duration(milliseconds: 10),
  ),
);

```
@brianquinlan
brianquinlan requested a review from a team as a code owner October 15, 2026 23:11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for custom retry behavior in Dart generated services by introducing an optional RetryRunner? retry parameter to service methods, fake methods, and templates. Feedback highlights two main issues: first, the retry parameter in fake_method.gotmpl is not forwarded to the underlying callbacks, preventing custom retry verification in tests; second, there is a discrepancy in method.gotmpl where the documentation states a default retry policy will be used, but the code explicitly defaults to noRetry.

@brianquinlan
brianquinlan merged commit 24344b6 into googleapis:main Oct 28, 2026
46 checks passed
zhumin8 pushed a commit that referenced this pull request Nov 3, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.51.0](v0.50.0...v0.51.0)
(2026-10-31)


### Features

* **dart:** support per-call retry
([#7787](#7787))
([24344b6](24344b6))
* **sidekick/rust:** convert proto2 optionals
([#7867](#7867))
([c9629b6](c9629b6))
* **sidekick:** mark `proto2` optional fields
([#7865](#7865))
([b91651f](b91651f))


### Bug Fixes

* **dart:** do not delete CHANGELOG.md
([#7817](#7817))
([4f027cb](4f027cb))
* **dart:** restore package description position
([#7370](#7370))
([bac42b7](bac42b7))
* **internal/librarian/dart:** set initial `librarian.yaml` version on
`bump` ([#7808](#7808))
([9f9042e](9f9042e))
* **internal/serviceconfig:** add title for shopping merchant reviews v1
([#7805](#7805))
([bf53ece](bf53ece))
* **internal/serviceconfig:** add title for shopping merchant reviews v1
([#7805](#7805))
([affbeb4](affbeb4))
* **sidekick/swift:** use fast WKTAny helpers
([#7826](#7826))
([b6c93c5](b6c93c5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
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