forked from toolshed/abra
fix: custom timeout only for "server add"
This commit is contained in:
@ -144,6 +144,11 @@ of your ~/.ssh/config. Checks for a valid online domain will be skipped:
|
||||
name = internal.ValidateDomain(c)
|
||||
}
|
||||
|
||||
// NOTE(d1): reasonable 5 second timeout for connections which can't
|
||||
// succeed. The connection is attempted twice, so this results in 10
|
||||
// seconds.
|
||||
timeout := client.WithTimeout(5)
|
||||
|
||||
if local {
|
||||
created, err := createServerDir(name)
|
||||
if err != nil {
|
||||
@ -152,7 +157,7 @@ of your ~/.ssh/config. Checks for a valid online domain will be skipped:
|
||||
|
||||
logrus.Debugf("attempting to create client for %s", name)
|
||||
|
||||
if _, err := client.New(name); err != nil {
|
||||
if _, err := client.New(name, timeout); err != nil {
|
||||
cleanUp(name)
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
@ -184,9 +189,8 @@ of your ~/.ssh/config. Checks for a valid online domain will be skipped:
|
||||
}
|
||||
|
||||
logrus.Debugf("attempting to create client for %s", name)
|
||||
if _, err := client.New(name); err != nil {
|
||||
if _, err := client.New(name, timeout); err != nil {
|
||||
cleanUp(name)
|
||||
logrus.Debugf("failed to construct client for %s, saw %s", name, err.Error())
|
||||
logrus.Fatal(sshPkg.Fatal(name, err))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user