Skip to content

Commit 1652eef

Browse files
authored
Fix missing retries in Page.next (dart-archive/gcloud#170)
* Fix missing retries in Page.next * Ignore deprecated usage * Propogate deprecation message
1 parent 0b7c4bb commit 1652eef

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

pkgs/gcloud/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 0.8.11
2+
- After the first `Page` created by `Datastore.withRetry()` retries were not
3+
happening. This is now fixed, ensuring that `Page.next()` will always retry
4+
when `Datastore` is wrapped with `Datastore.withRetry()`.
5+
- Calling with `wait: false` in `Subscription.pull(wait: false)` for `PubSub`
6+
have been deprecated.
7+
18
## 0.8.10
29

310
- Widen the SDK constraint to support Dart 3.0

pkgs/gcloud/lib/src/pubsub_impl.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class _PubSubImpl implements PubSub {
9797
String subscription, bool returnImmediately) {
9898
var request = pubsub.PullRequest()
9999
..maxMessages = 1
100+
// ignore: deprecated_member_use
100101
..returnImmediately = returnImmediately;
101102
return _api.projects.subscriptions.pull(request, subscription);
102103
}
@@ -428,7 +429,10 @@ class _SubscriptionImpl implements Subscription {
428429
Future delete() => _api._deleteSubscription(_subscription.name!);
429430

430431
@override
431-
Future<PullEvent?> pull({bool wait = true}) {
432+
Future<PullEvent?> pull({
433+
@Deprecated('returnImmediately has been deprecated from pubsub')
434+
bool wait = true,
435+
}) {
432436
return _api._pull(_subscription.name!, !wait).then((response) {
433437
// The documentation says 'Returns an empty list if there are no
434438
// messages available in the backlog'. However the receivedMessages

pkgs/gcloud/lib/src/retry_datastore_impl.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class _RetryPage<K> implements Page<K> {
135135

136136
@override
137137
Future<Page<K>> next({int? pageSize}) async {
138-
return await _retryOptions.retry(
138+
final nextPage = await _retryOptions.retry(
139139
() async {
140140
if (pageSize == null) {
141141
return await _delegate.next();
@@ -145,6 +145,7 @@ class _RetryPage<K> implements Page<K> {
145145
},
146146
retryIf: _retryIf,
147147
);
148+
return _RetryPage(nextPage, _retryOptions);
148149
}
149150
}
150151

pkgs/gcloud/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: gcloud
2-
version: 0.8.10
2+
version: 0.8.11
33
description: >-
44
High level idiomatic Dart API for Google Cloud Storage, Pub-Sub and Datastore.
55
repository: https://github.com/dart-lang/gcloud

0 commit comments

Comments
 (0)