mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 06:56:29 +00:00
Added etcd snapshot timeout parameter
This commit is contained in:
@@ -34,6 +34,10 @@ const (
|
||||
StopTimeout = 5
|
||||
// RetryCount is the amount of retries for Docker operations
|
||||
RetryCount = 3
|
||||
// WaitTimeout in seconds
|
||||
WaitTimeout = 300
|
||||
// WaitTimeoutContextKey name
|
||||
WaitTimeoutContextKey = "wait_timeout"
|
||||
)
|
||||
|
||||
type dockerConfig struct {
|
||||
@@ -492,8 +496,12 @@ func WaitForContainer(ctx context.Context, dClient *client.Client, hostname stri
|
||||
if dClient == nil {
|
||||
return 1, fmt.Errorf("Failed waiting for container: docker client is nil for container [%s] on host [%s]", containerName, hostname)
|
||||
}
|
||||
// 5 minutes timeout, especially for transferring snapshots
|
||||
for retries := 0; retries < 300; retries++ {
|
||||
// Set containerTimeout value from context or default. Especially for transferring snapshots
|
||||
containerTimeout := WaitTimeout
|
||||
if v, ok := ctx.Value(WaitTimeoutContextKey).(int); ok && v > 0 {
|
||||
containerTimeout = v
|
||||
}
|
||||
for retries := 0; retries < containerTimeout; retries++ {
|
||||
log.Infof(ctx, "Waiting for [%s] container to exit on host [%s]", containerName, hostname)
|
||||
container, err := InspectContainer(ctx, dClient, hostname, containerName)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user