mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
[#388] endpoint: fix incorrect use of trace.WithTaskGroup in ListAbstractionsStreamed
Capturing behavior was broken.
This commit is contained in:
parent
96d5288667
commit
61acc7494a
@ -52,9 +52,9 @@ func doZabsList(ctx context.Context, sc *cli.Subcommand, args []string) error {
|
|||||||
var line chainlock.L
|
var line chainlock.L
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
defer wg.Wait()
|
defer wg.Wait()
|
||||||
wg.Add(1)
|
|
||||||
|
|
||||||
// print results
|
// print results
|
||||||
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
enc := json.NewEncoder(os.Stdout)
|
enc := json.NewEncoder(os.Stdout)
|
||||||
|
@ -579,16 +579,17 @@ func ListAbstractionsStreamed(ctx context.Context, query ListZFSHoldsAndBookmark
|
|||||||
|
|
||||||
_, add, wait := trace.WithTaskGroup(ctx, "list-abstractions-impl-fs")
|
_, add, wait := trace.WithTaskGroup(ctx, "list-abstractions-impl-fs")
|
||||||
defer wait()
|
defer wait()
|
||||||
for i := range fss {
|
for _, fs := range fss {
|
||||||
|
fs := fs // capture by copy
|
||||||
add(func(ctx context.Context) {
|
add(func(ctx context.Context) {
|
||||||
g, err := sem.Acquire(ctx)
|
g, err := sem.Acquire(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errCb(err, fss[i], err.Error())
|
errCb(err, fs, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func() {
|
func() {
|
||||||
defer g.Release()
|
defer g.Release()
|
||||||
listAbstractionsImplFS(ctx, fss[i], &query, emitAbstraction, errCb)
|
listAbstractionsImplFS(ctx, fs, &query, emitAbstraction, errCb)
|
||||||
}()
|
}()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user