@@ -12,12 +12,11 @@ import (
1212 "syscall"
1313 "time"
1414
15- "golang.org/x/sync/errgroup"
16-
1715 "github.com/docker/docker/api/types/plugins/logdriver"
1816 "github.com/docker/docker/daemon/logger"
1917 "github.com/tonistiigi/fifo"
2018
19+ "github.com/rchicoli/docker-log-elasticsearch/internal/pkg/errgroup"
2120 "github.com/rchicoli/docker-log-elasticsearch/pkg/elasticsearch"
2221 "github.com/rchicoli/docker-log-elasticsearch/pkg/extension/grok"
2322
@@ -307,19 +306,12 @@ func (d *Driver) StopLogging(file string) error {
307306 }
308307 }
309308
310- if d .esClient != nil {
311- // l.Printf("INFO client: %v", d.esClient)
312- if err := d .esClient .Close (); err != nil {
313- l .Printf ("error: closing client connection: %v" , err )
314- }
315- d .esClient .Stop ()
316- }
317-
318309 if d .pipeline .group != nil {
319310 // l.Printf("INFO with pipeline: %v", d.pipeline)
320311
321312 // close(d.pipeline.inputCh)
322313 // close(d.pipeline.outputCh)
314+ d .pipeline .group .Stop ()
323315 // d.pipeline.stopCh <- struct{}{}
324316
325317 // TODO: close channels gracefully
@@ -330,6 +322,15 @@ func (d *Driver) StopLogging(file string) error {
330322 // l.Printf("error with pipeline: %v", err)
331323 // }
332324 }
325+
326+ if d .esClient != nil {
327+ // l.Printf("INFO client: %v", d.esClient)
328+ if err := d .esClient .Close (); err != nil {
329+ l .Printf ("error: closing client connection: %v" , err )
330+ }
331+ d .esClient .Stop ()
332+ }
333+
333334 // l.Printf("INFO done stop logging")
334335
335336 return nil
0 commit comments