mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
remove retries for pings in tsic
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
9c5301ee2e
commit
e90a669951
1 changed files with 42 additions and 50 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue