Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
Fix missing retries in Page.next (#170)
Browse files Browse the repository at this point in the history
* Fix missing retries in Page.next

* Ignore deprecated usage

* Propogate deprecation message
  • Loading branch information
jonasfj committed Aug 10, 2023
1 parent 12e82a1 commit 2ec9bcb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.8.11
- After the first `Page` created by `Datastore.withRetry()` retries were not
happening. This is now fixed, ensuring that `Page.next()` will always retry
when `Datastore` is wrapped with `Datastore.withRetry()`.
- Calling with `wait: false` in `Subscription.pull(wait: false)` for `PubSub`
have been deprecated.

## 0.8.10

- Widen the SDK constraint to support Dart 3.0
Expand Down
6 changes: 5 additions & 1 deletion lib/src/pubsub_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class _PubSubImpl implements PubSub {
String subscription, bool returnImmediately) {
var request = pubsub.PullRequest()
..maxMessages = 1
// ignore: deprecated_member_use
..returnImmediately = returnImmediately;
return _api.projects.subscriptions.pull(request, subscription);
}
Expand Down Expand Up @@ -428,7 +429,10 @@ class _SubscriptionImpl implements Subscription {
Future delete() => _api._deleteSubscription(_subscription.name!);

@override
Future<PullEvent?> pull({bool wait = true}) {
Future<PullEvent?> pull({
@Deprecated('returnImmediately has been deprecated from pubsub')
bool wait = true,
}) {
return _api._pull(_subscription.name!, !wait).then((response) {
// The documentation says 'Returns an empty list if there are no
// messages available in the backlog'. However the receivedMessages
Expand Down
3 changes: 2 additions & 1 deletion lib/src/retry_datastore_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class _RetryPage<K> implements Page<K> {

@override
Future<Page<K>> next({int? pageSize}) async {
return await _retryOptions.retry(
final nextPage = await _retryOptions.retry(
() async {
if (pageSize == null) {
return await _delegate.next();
Expand All @@ -145,6 +145,7 @@ class _RetryPage<K> implements Page<K> {
},
retryIf: _retryIf,
);
return _RetryPage(nextPage, _retryOptions);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: gcloud
version: 0.8.10
version: 0.8.11
description: >-
High level idiomatic Dart API for Google Cloud Storage, Pub-Sub and Datastore.
repository: https://github.com/dart-lang/gcloud
Expand Down

0 comments on commit 2ec9bcb

Please sign in to comment.