diff options
| author | chrislu <chris.lu@gmail.com> | 2022-09-25 17:42:23 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-09-25 17:42:23 -0700 |
| commit | 648b33beb0306f8698e09bfc0f8be8b78b26e36a (patch) | |
| tree | 2d2023ed97490df4bb7a1959498ac9aeca66e2ca /weed/util/limited_async_pool_test.go | |
| parent | 1484cb224f4e31851a0e45ed29c6f0d072f0856f (diff) | |
| download | seaweedfs-648b33beb0306f8698e09bfc0f8be8b78b26e36a.tar.xz seaweedfs-648b33beb0306f8698e09bfc0f8be8b78b26e36a.zip | |
add future list
Diffstat (limited to 'weed/util/limited_async_pool_test.go')
| -rw-r--r-- | weed/util/limited_async_pool_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/weed/util/limited_async_pool_test.go b/weed/util/limited_async_pool_test.go index 935b158da..090ce5375 100644 --- a/weed/util/limited_async_pool_test.go +++ b/weed/util/limited_async_pool_test.go @@ -10,17 +10,17 @@ import ( func TestAsyncPool(t *testing.T) { p := NewLimitedAsyncExecutor(3) - var results []Future - results = append(results, p.Execute(FirstFunc)) - results = append(results, p.Execute(SecondFunc)) - results = append(results, p.Execute(ThirdFunc)) - results = append(results, p.Execute(FourthFunc)) - results = append(results, p.Execute(FifthFunc)) + p.Execute(FirstFunc) + p.Execute(SecondFunc) + p.Execute(ThirdFunc) + p.Execute(FourthFunc) + p.Execute(FifthFunc) var sorted_results []int - for _, r := range results { - x := r.Await().(int) + for i := 0; i < 5; i++ { + f := p.NextFuture() + x := f.Await().(int) println(x) sorted_results = append(sorted_results, x) } |
