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