@@ -17,6 +17,7 @@ import (
1717 "github.com/docker/go-units"
1818 "github.com/pkg/errors"
1919
20+ "gitlab.com/postgres-ai/database-lab/v3/internal/provision/pool"
2021 "gitlab.com/postgres-ai/database-lab/v3/internal/retrieval/engine/postgres/tools"
2122 "gitlab.com/postgres-ai/database-lab/v3/internal/retrieval/options"
2223 "gitlab.com/postgres-ai/database-lab/v3/pkg/log"
@@ -63,7 +64,7 @@ const (
6364// TODO(akartasov): Control container manager.
6465
6566// StopControlContainers stops control containers run by Database Lab Engine.
66- func StopControlContainers (ctx context.Context , dockerClient * client.Client , instanceID , dataDir string ) error {
67+ func StopControlContainers (ctx context.Context , dockerClient * client.Client , instanceID string , fsm pool. FSManager ) error {
6768 log .Msg ("Stop control containers" )
6869
6970 list , err := getContainerList (ctx , dockerClient , instanceID , getControlContainerFilters ())
@@ -80,10 +81,10 @@ func StopControlContainers(ctx context.Context, dockerClient *client.Client, ins
8081 continue
8182 }
8283
83- if shouldStopInternalProcess (controlLabel ) {
84+ if shouldStopInternalProcess (controlLabel ) && fsm != nil {
8485 log .Msg ("Stopping control container: " , containerName )
8586
86- if err := tools .StopPostgres (ctx , dockerClient , controlCont .ID , dataDir , tools .DefaultStopTimeout ); err != nil {
87+ if err := tools .StopPostgres (ctx , dockerClient , controlCont .ID , fsm . Pool (). DataDir () , tools .DefaultStopTimeout ); err != nil {
8788 log .Msg ("Failed to stop Postgres" , err )
8889 tools .PrintContainerLogs (ctx , dockerClient , controlCont .ID )
8990
0 commit comments