From 98906ed6ea1afc5a758871a7c2d8251fccaef106 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 26 Apr 2024 18:46:00 +0400 Subject: [PATCH] fix: use reboot delay only in case of error Delay the reboot for 10 seconds only if Talos hits an error, but otherwise just proceed with the requested action. This removes 10 seconds on "regular" reboot without kexec. Signed-off-by: Andrey Smirnov --- internal/app/machined/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/app/machined/main.go b/internal/app/machined/main.go index f8858d8143..354b84d66b 100644 --- a/internal/app/machined/main.go +++ b/internal/app/machined/main.go @@ -118,12 +118,12 @@ func handle(ctx context.Context, err error) { rebootCmd = 0 } } - } - if rebootCmd == unix.LINUX_REBOOT_CMD_RESTART { - for i := 10; i >= 0; i-- { - log.Printf("rebooting in %d seconds\n", i) - time.Sleep(1 * time.Second) + if rebootCmd == unix.LINUX_REBOOT_CMD_RESTART { + for i := 10; i >= 0; i-- { + log.Printf("rebooting in %d seconds\n", i) + time.Sleep(1 * time.Second) + } } }