-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* De-async health checks * add debug * Delay client * Use non-delayed client * Shorter duration * Make client private * Add changelog
- Loading branch information
Showing
6 changed files
with
116 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "health", | ||
"program": "pkgs/firehose/bin/health.dart", | ||
"request": "launch", | ||
"type": "dart", | ||
"env": { | ||
"GITHUB_REPOSITORY": "dart-lang/ecosystem", | ||
"ISSUE_NUMBER": "173", | ||
"GITHUB_SHA": "null", | ||
"GITHUB_STEP_SUMMARY": "/tmp/github_step_summary_mock.md", | ||
}, | ||
"args": [ | ||
"--checks", | ||
"version,changelog,license,coverage,do-not-submit" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:convert'; | ||
|
||
import 'dart:typed_data'; | ||
|
||
import 'package:http/http.dart' as http; | ||
|
||
class DelayedClient implements http.Client { | ||
final http.Client _client; | ||
final Duration duration; | ||
|
||
factory DelayedClient(Duration duration) => DelayedClient._( | ||
client: http.Client(), | ||
duration: duration, | ||
); | ||
|
||
DelayedClient._({required this.duration, required http.Client client}) | ||
: _client = client; | ||
|
||
@override | ||
void close() => _client.close(); | ||
|
||
@override | ||
Future<http.Response> delete(Uri url, | ||
{Map<String, String>? headers, Object? body, Encoding? encoding}) => | ||
Future.delayed( | ||
duration, | ||
() => _client.delete(url, | ||
body: body, encoding: encoding, headers: headers)); | ||
|
||
@override | ||
Future<http.Response> get(Uri url, {Map<String, String>? headers}) => | ||
Future.delayed(duration, () => _client.get(url, headers: headers)); | ||
|
||
@override | ||
Future<http.Response> head(Uri url, {Map<String, String>? headers}) => | ||
Future.delayed(duration, () => _client.head(url, headers: headers)); | ||
|
||
@override | ||
Future<http.Response> patch(Uri url, | ||
{Map<String, String>? headers, Object? body, Encoding? encoding}) => | ||
Future.delayed( | ||
duration, | ||
() => _client.patch(url, | ||
headers: headers, body: body, encoding: encoding)); | ||
|
||
@override | ||
Future<http.Response> post(Uri url, | ||
{Map<String, String>? headers, Object? body, Encoding? encoding}) => | ||
Future.delayed( | ||
duration, | ||
() => _client.post(url, | ||
headers: headers, body: body, encoding: encoding)); | ||
@override | ||
Future<http.Response> put(Uri url, | ||
{Map<String, String>? headers, Object? body, Encoding? encoding}) => | ||
Future.delayed( | ||
duration, | ||
() => _client.put(url, | ||
headers: headers, body: body, encoding: encoding)); | ||
@override | ||
Future<String> read(Uri url, {Map<String, String>? headers}) => | ||
Future.delayed(duration, () => _client.read(url, headers: headers)); | ||
|
||
@override | ||
Future<Uint8List> readBytes(Uri url, {Map<String, String>? headers}) => | ||
Future.delayed(duration, () => _client.readBytes(url, headers: headers)); | ||
|
||
@override | ||
Future<http.StreamedResponse> send(http.BaseRequest request) => | ||
Future.delayed(duration, () => _client.send(request)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters