Unverified Commit 9afe68b8 authored by Darren Shepherd's avatar Darren Shepherd Committed by GitHub
Browse files

Merge pull request #26433 from ibuildthecloud/addtimeout

Add remote dialer backup timeout
parents 6101bca9 948a6bba
Showing with 22 additions and 5 deletions
+22 -5
......@@ -82,7 +82,7 @@ require (
github.com/rancher/machine v0.15.0-rancher25
github.com/rancher/norman v0.0.0-20200401184723-a6df1fcaebe0
github.com/rancher/rdns-server v0.0.0-20180802070304-bf662911db6a
github.com/rancher/remotedialer v0.2.5
github.com/rancher/remotedialer v0.2.6-0.20200401224317-04cc22157b83
github.com/rancher/rke v1.1.0
github.com/rancher/security-scan v0.1.7-0.20200222041501-f7377f127168
github.com/rancher/steve v0.0.0-20200401220414-61a905156cd1
......
......@@ -5,12 +5,29 @@ import (
"errors"
"io"
"net"
"os"
"strconv"
"sync"
"time"
"github.com/rancher/remotedialer/metrics"
)
var (
backupTimeout = 15 * time.Second
)
func init() {
t := os.Getenv("REMOTEDIALER_BACKUP_TIMEOUT_SECONDS")
if t != "" {
i, err := strconv.Atoi(t)
if err != nil {
panic("invalid number " + t + " for REMOTEDIALER_BACKUP_TIMEOUT_SECONDS")
}
backupTimeout = time.Duration(i) * time.Second
}
}
type connection struct {
sync.Mutex
......@@ -191,7 +208,7 @@ func (c chanWriter) Write(buf []byte) (int, error) {
select {
case c.C <- buf:
return len(buf), nil
case <-time.After(15 * time.Second):
case <-time.After(backupTimeout):
return 0, errors.New("backed up reader")
}
}
......
......@@ -410,7 +410,7 @@ github.com/rancher/norman/types/values
github.com/rancher/norman/urlbuilder
# github.com/rancher/rdns-server v0.0.0-20180802070304-bf662911db6a
github.com/rancher/rdns-server/model
# github.com/rancher/remotedialer v0.2.5
# github.com/rancher/remotedialer v0.2.6-0.20200401224317-04cc22157b83
github.com/rancher/remotedialer
github.com/rancher/remotedialer/metrics
# github.com/rancher/rke v1.1.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment