Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: tools/gardening/lib/src/client.dart

Issue 2998993002: Use timeout to read most recent build from http (Closed)
Patch Set: Updated cf. comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gardening/lib/src/buildbot_loading.dart ('k') | tools/gardening/lib/src/compare_failures_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/lib/src/client.dart
diff --git a/tools/gardening/lib/src/client.dart b/tools/gardening/lib/src/client.dart
index f73a50df5efdeb18501806c07e42d9c9ad58c9f5..850a2f96f3f6b58e1f3af7a9fe84321ac3a99908 100644
--- a/tools/gardening/lib/src/client.dart
+++ b/tools/gardening/lib/src/client.dart
@@ -28,16 +28,40 @@ class HttpBuildbotClient implements BuildbotClient {
@override
Future<BuildResult> readResult(BuildUri buildUri) async {
- try {
- return await readBuildResultFromHttp(_client, buildUri);
- } on HttpException {
- return null;
- } on SocketException {
- return null;
+ Duration timeout;
+ if (buildUri.buildNumber < 0) {
+ timeout = new Duration(seconds: 1);
+ }
+
+ void skipToPreviousBuildNumber() {
+ BuildUri prevBuildUri = buildUri.prev();
+ log('Skip build number '
+ '${buildUri.buildNumber} -> ${prevBuildUri.buildNumber}');
+ buildUri = buildUri.prev();
+ }
+
+ while (true) {
+ try {
+ return await readBuildResultFromHttp(_client, buildUri, timeout);
+ } on TimeoutException {
+ if (timeout != null) {
+ skipToPreviousBuildNumber();
+ continue;
+ }
+ return null;
+ } on HttpException {
+ if (timeout != null) {
+ skipToPreviousBuildNumber();
+ continue;
+ }
+ return null;
+ } on SocketException {
+ return null;
+ }
}
}
- int get mostRecentBuildNumber => -2;
+ int get mostRecentBuildNumber => -1;
@override
void close() {
« no previous file with comments | « tools/gardening/lib/src/buildbot_loading.dart ('k') | tools/gardening/lib/src/compare_failures_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698