From 100eeda464e8da43bb94f195aae685f27effdfbb Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Thu, 28 Apr 2022 14:55:01 +0200 Subject: [PATCH] Retry initializing TTY size a bit more I some cases, for example if there is a heavy load, the initialization of the TTY size would fail. This change makes the cli retry more times, 10 instead of 5 and we wait 100ms between two calls to resize the TTY. Relates to #3554 Signed-off-by: Djordje Lukic --- cli/command/container/tty.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/command/container/tty.go b/cli/command/container/tty.go index cc64f999dc47..d86a0266d8ad 100644 --- a/cli/command/container/tty.go +++ b/cli/command/container/tty.go @@ -45,7 +45,7 @@ func resizeTty(ctx context.Context, cli command.Cli, id string, isExec bool) err return resizeTtyTo(ctx, cli.Client(), id, height, width, isExec) } -// initTtySize is to init the tty's size to the same as the window, if there is an error, it will retry 5 times. +// initTtySize is to init the tty's size to the same as the window, if there is an error, it will retry 10 times. func initTtySize(ctx context.Context, cli command.Cli, id string, isExec bool, resizeTtyFunc func(ctx context.Context, cli command.Cli, id string, isExec bool) error) { rttyFunc := resizeTtyFunc if rttyFunc == nil { @@ -54,8 +54,8 @@ func initTtySize(ctx context.Context, cli command.Cli, id string, isExec bool, r if err := rttyFunc(ctx, cli, id, isExec); err != nil { go func() { var err error - for retry := 0; retry < 5; retry++ { - time.Sleep(10 * time.Millisecond) + for retry := 0; retry < 10; retry++ { + time.Sleep(100 * time.Millisecond) if err = rttyFunc(ctx, cli, id, isExec); err == nil { break }