Fix missing retries in Page.next (#170)
* Fix missing retries in Page.next
* Ignore deprecated usage
* Propogate deprecation message
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb60415..a0466bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/lib/src/pubsub_impl.dart b/lib/src/pubsub_impl.dart
index ce491b1..cfdb3ac 100644
--- a/lib/src/pubsub_impl.dart
+++ b/lib/src/pubsub_impl.dart
@@ -97,6 +97,7 @@
String subscription, bool returnImmediately) {
var request = pubsub.PullRequest()
..maxMessages = 1
+ // ignore: deprecated_member_use
..returnImmediately = returnImmediately;
return _api.projects.subscriptions.pull(request, subscription);
}
@@ -428,7 +429,10 @@
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
diff --git a/lib/src/retry_datastore_impl.dart b/lib/src/retry_datastore_impl.dart
index e57410c..72b7527 100644
--- a/lib/src/retry_datastore_impl.dart
+++ b/lib/src/retry_datastore_impl.dart
@@ -135,7 +135,7 @@
@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();
@@ -145,6 +145,7 @@
},
retryIf: _retryIf,
);
+ return _RetryPage(nextPage, _retryOptions);
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 7a58f69..aa12193 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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