[cloud functions] Retry the update of processed_chunks count if it fails
Change-Id: I31c99b397d4235ce7b37fbb9cd9b9a7928ccc523
Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/135314
Reviewed-by: Alexander Thomas <athom@google.com>
diff --git a/functions/node/firestore_impl.dart b/functions/node/firestore_impl.dart
index 1f72f74..bbf1fe9 100644
--- a/functions/node/firestore_impl.dart
+++ b/functions/node/firestore_impl.dart
@@ -4,6 +4,7 @@
import 'dart:math' show max, min;
import 'package:firebase_admin_interop/firebase_admin_interop.dart';
+import 'package:retry/retry.dart';
import 'firestore.dart';
@@ -366,7 +367,10 @@
transaction.update(document, update);
}
- return firestore.runTransaction(updateStatus);
+ await retry(() => firestore.runTransaction(updateStatus), retryIf: (e) {
+ info("Retrying failed update: $e");
+ return e.toString().contains('Please try again.');
+ });
}
Future<void> storeBuildChunkCount(
@@ -398,7 +402,10 @@
transaction.update(reference, update);
}
- return firestore.runTransaction(updateStatus);
+ await retry(() => firestore.runTransaction(updateStatus), retryIf: (e) {
+ info("Retrying failed update: $e");
+ return e.toString().contains('Please try again.');
+ });
}
Future<void> storeTryBuildChunkCount(String builder, int buildNumber,
diff --git a/functions/pubspec.lock b/functions/pubspec.lock
index 1fdeda1..44a66ae 100644
--- a/functions/pubspec.lock
+++ b/functions/pubspec.lock
@@ -7,7 +7,7 @@
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
- version: "0.38.4"
+ version: "0.38.5"
args:
dependency: transitive
description:
@@ -21,98 +21,98 @@
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.3.0"
+ version: "2.4.0"
bazel_worker:
dependency: transitive
description:
name: bazel_worker
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.22"
+ version: "0.1.23+1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
+ version: "2.0.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.2"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.1+1"
+ version: "0.4.2"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.3"
build_modules:
dependency: transitive
description:
name: build_modules
url: "https://pub.dartlang.org"
source: hosted
- version: "2.6.2"
+ version: "2.8.0"
build_node_compilers:
dependency: "direct dev"
description:
name: build_node_compilers
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.3"
+ version: "0.2.4"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.8"
+ version: "1.2.1"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.1"
+ version: "1.7.4"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
- version: "4.1.0"
+ version: "4.4.0"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
- version: "4.2.2"
+ version: "4.3.2"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
- version: "6.7.1"
+ version: "7.0.9"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.2"
+ version: "1.1.3"
checked_yaml:
dependency: transitive
description:
@@ -126,7 +126,7 @@
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
- version: "3.2.0"
+ version: "3.2.1"
collection:
dependency: transitive
description:
@@ -147,14 +147,14 @@
name: coverage
url: "https://pub.dartlang.org"
source: hosted
- version: "0.13.3+1"
+ version: "0.13.6"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.3"
+ version: "2.1.4"
csslib:
dependency: transitive
description:
@@ -168,7 +168,7 @@
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.3"
firebase_admin_interop:
dependency: transitive
description:
@@ -189,21 +189,21 @@
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
- version: "0.10.9"
+ version: "0.10.11"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.26"
+ version: "0.1.27"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.7"
+ version: "1.2.0"
graphs:
dependency: transitive
description:
@@ -217,21 +217,21 @@
name: html
url: "https://pub.dartlang.org"
source: hosted
- version: "0.14.0+2"
+ version: "0.14.0+3"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.0+2"
+ version: "0.12.0+4"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.2.0"
http_parser:
dependency: transitive
description:
@@ -259,21 +259,21 @@
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
- version: "3.0.0"
+ version: "3.0.1"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
- version: "0.3.26"
+ version: "0.3.27"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
- version: "0.11.3+2"
+ version: "0.11.4"
matcher:
dependency: transitive
description:
@@ -287,7 +287,7 @@
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.7"
+ version: "1.1.8"
mime:
dependency: transitive
description:
@@ -364,7 +364,7 @@
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0+1"
+ version: "1.9.0"
pool:
dependency: "direct main"
description:
@@ -378,14 +378,14 @@
name: protobuf
url: "https://pub.dartlang.org"
source: hosted
- version: "0.14.4"
+ version: "1.0.1"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
- version: "1.4.2"
+ version: "1.4.3"
pubspec_parse:
dependency: transitive
description:
@@ -399,7 +399,7 @@
name: quiver
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.5"
+ version: "2.1.2+1"
quiver_hashcode:
dependency: transitive
description:
@@ -407,13 +407,20 @@
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
+ retry:
+ dependency: "direct main"
+ description:
+ name: retry
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.0+1"
scratch_space:
dependency: transitive
description:
name: scratch_space
url: "https://pub.dartlang.org"
source: hosted
- version: "0.0.4"
+ version: "0.0.4+2"
shelf:
dependency: transitive
description:
@@ -455,14 +462,14 @@
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
- version: "0.10.8"
+ version: "0.10.9"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.5"
+ version: "1.6.0"
stack_trace:
dependency: transitive
description:
@@ -483,7 +490,7 @@
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
- version: "0.0.19"
+ version: "1.1.0"
string_scanner:
dependency: transitive
description:
@@ -504,21 +511,21 @@
name: test
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.4"
+ version: "1.12.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.11"
+ version: "0.2.14"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.15"
+ version: "0.3.0"
timing:
dependency: transitive
description:
@@ -539,21 +546,28 @@
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.2"
+ version: "2.3.1"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.9.7+12"
+ version: "0.9.7+13"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.15"
+ version: "1.1.0"
+ webkit_inspection_protocol:
+ dependency: transitive
+ description:
+ name: webkit_inspection_protocol
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.5.0"
yaml:
dependency: transitive
description:
@@ -562,4 +576,4 @@
source: hosted
version: "2.2.0"
sdks:
- dart: ">=2.5.0 <3.0.0"
+ dart: ">=2.6.0 <3.0.0"
diff --git a/functions/pubspec.yaml b/functions/pubspec.yaml
index 377c0d2..22b9518 100644
--- a/functions/pubspec.yaml
+++ b/functions/pubspec.yaml
@@ -10,6 +10,7 @@
dependencies:
firebase_functions_interop: ^1.0.2
pool: ^1.4.0
+ retry: ^3.0.0
dev_dependencies:
build_runner: ^1.7.1