remove retries for pings in tsic

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2023-07-26 17:51:33 +02:00 committed by Kristoffer Dalby
parent 9c5301ee2e
commit e90a669951

View file

@ -11,7 +11,6 @@ import (
"strings"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/juanfont/headscale/hscontrol/util"
"github.com/juanfont/headscale/integration/dockertestutil"
"github.com/juanfont/headscale/integration/integrationutil"
@ -592,7 +591,7 @@ func WithPingUntilDirect(direct bool) PingOption {
// TODO(kradalby): Make multiping, go routine magic.
func (t *TailscaleInContainer) Ping(hostnameOrIP string, opts ...PingOption) error {
args := pingArgs{
timeout: time.Second,
timeout: 300 * time.Millisecond,
count: defaultPingCount,
direct: true,
}
@ -610,7 +609,6 @@ func (t *TailscaleInContainer) Ping(hostnameOrIP string, opts ...PingOption) err
command = append(command, hostnameOrIP)
return t.pool.Retry(func() error {
result, _, err := t.Execute(
command,
dockertestutil.ExecuteCommandTimeout(
@ -633,19 +631,18 @@ func (t *TailscaleInContainer) Ping(hostnameOrIP string, opts ...PingOption) err
}
if !strings.Contains(result, "pong") {
return backoff.Permanent(errTailscalePingFailed)
return errTailscalePingFailed
}
if !args.direct {
if strings.Contains(result, "via DERP") {
return nil
} else {
return backoff.Permanent(errTailscalePingNotDERP)
return errTailscalePingNotDERP
}
}
return nil
})
}
type (
@ -720,9 +717,7 @@ func (t *TailscaleInContainer) Curl(url string, opts ...CurlOption) (string, err
}
var result string
err := t.pool.Retry(func() error {
var err error
result, _, err = t.Execute(command)
result, _, err := t.Execute(command)
if err != nil {
log.Printf(
"failed to run curl command from %s to %s, err: %s",
@ -731,13 +726,10 @@ func (t *TailscaleInContainer) Curl(url string, opts ...CurlOption) (string, err
err,
)
return err
return result, err
}
return nil
})
return result, err
return result, nil
}
// WriteFile save file inside the Tailscale container.