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

Unified Diff: tools/gardening/lib/src/util.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/compare_failures_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/lib/src/util.dart
diff --git a/tools/gardening/lib/src/util.dart b/tools/gardening/lib/src/util.dart
index 51b50c1e3dec79d037401a16254d3a4046ee07ee..ba80e6e6372bec8609051e3cf99dc7977762461b 100644
--- a/tools/gardening/lib/src/util.dart
+++ b/tools/gardening/lib/src/util.dart
@@ -65,14 +65,19 @@ class HttpException implements Exception {
}
/// Reads the content of [uri] as text.
-Future<String> readUriAsText(HttpClient client, Uri uri) async {
+Future<String> readUriAsText(
+ HttpClient client, Uri uri, Duration timeout) async {
HttpClientRequest request = await client.getUrl(uri);
HttpClientResponse response = await request.close();
if (response.statusCode != 200) {
response.drain();
throw new HttpException(uri, response.statusCode);
}
- return response.transform(UTF8.decoder).join();
+ if (timeout != null) {
+ return response.timeout(timeout).transform(UTF8.decoder).join();
+ } else {
+ return response.transform(UTF8.decoder).join();
+ }
}
ArgParser createArgParser() {
« no previous file with comments | « tools/gardening/lib/src/compare_failures_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698