mirror of
https://github.com/docker/compose.git
synced 2025-07-25 22:54:54 +02:00
apply linter recommendations
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
e7284e76e9
commit
eeb09d9e80
@ -40,7 +40,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *local) ensureService(ctx context.Context, project *types.Project, service types.ServiceConfig) error {
|
func (s *local) ensureService(ctx context.Context, project *types.Project, service types.ServiceConfig) error {
|
||||||
s.waitDependencies(ctx, project, service)
|
err := s.waitDependencies(ctx, project, service)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
actual, err := s.containerService.apiClient.ContainerList(ctx, moby.ContainerListOptions{
|
actual, err := s.containerService.apiClient.ContainerList(ctx, moby.ContainerListOptions{
|
||||||
Filters: filters.NewArgs(
|
Filters: filters.NewArgs(
|
||||||
@ -117,7 +120,10 @@ func (s *local) waitDependencies(ctx context.Context, project *types.Project, se
|
|||||||
switch config.Condition {
|
switch config.Condition {
|
||||||
case "service_healthy":
|
case "service_healthy":
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
for range time.Tick(500 * time.Millisecond) {
|
ticker := time.NewTicker(500 * time.Millisecond)
|
||||||
|
defer ticker.Stop()
|
||||||
|
for {
|
||||||
|
<-ticker.C
|
||||||
healthy, err := s.isServiceHealthy(ctx, project, dep)
|
healthy, err := s.isServiceHealthy(ctx, project, dep)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -126,7 +132,6 @@ func (s *local) waitDependencies(ctx context.Context, project *types.Project, se
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,9 @@ type node struct {
|
|||||||
dependent []string
|
dependent []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d dependencyGraph) independents() []node {
|
func (graph dependencyGraph) independents() []node {
|
||||||
var nodes []node
|
var nodes []node
|
||||||
for _, node := range d {
|
for _, node := range graph {
|
||||||
if len(node.dependencies) == 0 {
|
if len(node.dependencies) == 0 {
|
||||||
nodes = append(nodes, node)
|
nodes = append(nodes, node)
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,3 @@ func contains(slice []string, item string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func containsAll(slice []string, items []string) bool {
|
|
||||||
for _, i := range items {
|
|
||||||
if !contains(slice, i) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user