fix `await null` in forEach
Benchmark goes from ~54ms to ~33ms
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c3d314..c680dd2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 1.4.1
+
+* `forEach`: Avoid `await null` if the `Stream` is not paused.
+ Improves trivial benchmark by 40%.
+
## 1.4.0
* Add `forEach` to `Pool` to support efficient async processing of an
diff --git a/lib/pool.dart b/lib/pool.dart
index 779300e..12dd5e1 100644
--- a/lib/pool.dart
+++ b/lib/pool.dart
@@ -170,7 +170,9 @@
_resetTimer();
- await resumeCompleter?.future;
+ if (resumeCompleter != null) {
+ await resumeCompleter.future;
+ }
if (cancelPending) {
break;
diff --git a/pubspec.yaml b/pubspec.yaml
index 35fb62d..ebb05d9 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: pool
-version: 1.4.0
+version: 1.4.1-dev
description: >-
Manage a finite pool of resources.