mirror of
https://github.com/containrrr/watchtower.git
synced 2026-02-19 05:38:07 +01:00
fix: always add missing slashes to link names
previously, this was only done when marking dependant containers for restart. but since the names should ALWAYS start with a slash, this check could be performed every time the container is iterated. the only downside to this is that it's less performant (as it needs to copy the strings instead of just having the slices point to the same source string), but it should not be noticable.
This commit is contained in:
parent
bbbe04119c
commit
533bfc0e8b
3 changed files with 17 additions and 8 deletions
|
|
@ -2,7 +2,6 @@ package actions
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/containrrr/watchtower/internal/util"
|
||||
"github.com/containrrr/watchtower/pkg/container"
|
||||
|
|
@ -260,10 +259,6 @@ func UpdateImplicitRestart(containers []container.Container) {
|
|||
// container marked for restart
|
||||
func linkedContainerMarkedForRestart(links []string, containers []container.Container) string {
|
||||
for _, linkName := range links {
|
||||
// Since the container names need to start with '/', let's prepend it if it's missing
|
||||
if !strings.HasPrefix(linkName, "/") {
|
||||
linkName = "/" + linkName
|
||||
}
|
||||
for _, candidate := range containers {
|
||||
if candidate.Name() == linkName && candidate.ToRestart() {
|
||||
return linkName
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue