-
Notifications
You must be signed in to change notification settings - Fork 94
fix(pool): fix forEach cleanup on error and enable WasmGC tests #2360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d17736a
Evaluate and improve pool package
kevmoo 7e6292e
fun
kevmoo 9631a44
enable node!
kevmoo d9d01a4
two more fixes
kevmoo e014f80
private bits in test
kevmoo 9d7131c
add an example while we're at it!
kevmoo 00d95e7
tiny nit about iterable silly
kevmoo edcee46
Update pkgs/pool/CHANGELOG.md
kevmoo be69385
review feedback
kevmoo 744f5b8
Merge branch 'main' into pool_fun
kevmoo b325bbc
Merge remote-tracking branch 'origin/pool_fun' into pool_fun
kevmoo f37d2e0
a test and a fix
kevmoo 89eaa62
prepare release
kevmoo 5def979
rollback other changes
kevmoo 0ffc576
refactor(pool): separate unrelated tests and scope
kevmoo 0d47471
Merge remote-tracking branch 'origin/main' into pool_fun
kevmoo e1e28f5
chore(pool): keep 1.5.3-wip version
kevmoo 4d18c38
revert: undo hook-induced formatting across unrelated packages
kevmoo a297a61
fix(pool): address review feedback and enable WasmGC tests on Chrome
kevmoo a7e3994
test(pool): use pumpEventQueue instead of Future.delayed
kevmoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,31 @@ | ||
| // Copyright (c) 2026, 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 'package:pool/pool.dart'; | ||
|
|
||
| void main() async { | ||
| // Create a pool that allows at most 3 concurrent resources. | ||
| final pool = Pool(3); | ||
|
|
||
| print('Starting tasks with pool size of 3...'); | ||
|
|
||
| // Use pool.forEach to process a list of items concurrently. | ||
| // This is useful for limiting concurrent network requests or file I/O. | ||
| final items = List.generate(10, (i) => i); | ||
|
|
||
| await for (final result in pool.forEach(items, (item) async { | ||
| print(' [Start] Processing item $item'); | ||
| // Simulate some async work like a network request. | ||
| await Future<void>.delayed(const Duration(milliseconds: 100)); | ||
| print(' [Done] Processing item $item'); | ||
| return 'Result for $item'; | ||
| })) { | ||
| print('Processed: $result'); | ||
| } | ||
|
kevmoo marked this conversation as resolved.
Outdated
|
||
|
|
||
| print('All tasks completed!'); | ||
|
|
||
| // Close the pool. | ||
| await pool.close(); | ||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.