Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Force close the http-client on IOAnalytics.close() (#155)
Browse files Browse the repository at this point in the history
force close the http-client on IOAnalytics.close()
  • Loading branch information
sigurdm committed Mar 22, 2021
1 parent 21e6d3c commit 5b7317b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.1
- Force close the http client from `IOAnalytics.close()`.
This prevents lingering requests from making the application hang.

## 4.0.0
- Publishing a null safe stable release.

Expand Down
6 changes: 5 additions & 1 deletion lib/src/usage_impl_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ class IOPostHandler extends PostHandler {
}

@override
void close() => _client?.close();
void close() {
// Do a force close to ensure that lingering requests will not stall the
// program.
_client?.close(force: true);
}
}

JsonEncoder _jsonEncoder = JsonEncoder.withIndent(' ');
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.

name: usage
version: 4.0.0
version: 4.0.1
description: A Google Analytics wrapper for command-line, web, and Flutter apps.
homepage: https://github.com/dart-lang/usage

Expand Down

0 comments on commit 5b7317b

Please sign in to comment.