fix: lost last write
This commit is contained in:
parent
24564489b8
commit
059550898e
@ -11,6 +11,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/loveuer/esgo2dump/internal/interfaces"
|
||||
"github.com/loveuer/esgo2dump/internal/opt"
|
||||
@ -192,17 +193,16 @@ func executeData(ctx context.Context, input, output interfaces.DumpIO) error {
|
||||
|
||||
e2ch = make(chan error)
|
||||
wch = make(chan []*model.ESSource)
|
||||
wg = sync.WaitGroup{}
|
||||
)
|
||||
|
||||
go func() {
|
||||
defer func() {
|
||||
close(wch)
|
||||
close(e2ch)
|
||||
}()
|
||||
|
||||
wg.Add(1)
|
||||
if err = output.WriteData(ctx, wch); err != nil {
|
||||
e2ch <- err
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
log.Info("Query: got queries=%d", len(queries))
|
||||
@ -233,6 +233,10 @@ Loop:
|
||||
}
|
||||
}
|
||||
|
||||
close(wch)
|
||||
|
||||
wg.Wait()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user