Skip to content

Commit 3331425

Browse files
authored
Increase timeout for operations requiring reboot to 90s (#556)
Users are sometimes confused when they try to reboot or switch slots and the operation fails with the generic error, while it's been already submitted and is performed shortly after. Allow more time for the operation to finish gracefully, as terminating it while it's been posted usually wouldn't cancel it anyway.
1 parent e31e805 commit 3331425

4 files changed

Lines changed: 4 additions & 3 deletions

File tree

client/helper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const ContainerOperationTimeout = 10 * time.Minute
2323
const ContainerDownloadTimeout = 1 * time.Hour
2424
const OsDownloadTimeout = 1 * time.Hour
2525
const BackupTimeout = 3 * time.Hour
26+
const RebootTimeout = 90 * time.Second
2627

2728
var client *resty.Client
2829

cmd/host_reboot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Reboot the machine that your Home Assistant is running on.`,
3131
options["force"] = force
3232
}
3333

34-
resp, err := helper.GenericJSONPost(section, command, options)
34+
resp, err := helper.GenericJSONPostTimeout(section, command, options, helper.RebootTimeout)
3535
if err != nil {
3636
fmt.Println(err)
3737
ExitWithError = true

cmd/host_shutdown.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ WARNING: This is turning off the computer/device.`,
3232
options["force"] = force
3333
}
3434

35-
resp, err := helper.GenericJSONPost(section, command, options)
35+
resp, err := helper.GenericJSONPostTimeout(section, command, options, helper.RebootTimeout)
3636
if err != nil {
3737
fmt.Println(err)
3838
ExitWithError = true

cmd/os_boot_slot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ an OS update without making more changes to the system.
5858
}
5959

6060
options := map[string]any{"boot_slot": bootSlot}
61-
resp, err := helper.GenericJSONPost(section, command, options)
61+
resp, err := helper.GenericJSONPostTimeout(section, command, options, helper.RebootTimeout)
6262
if err != nil {
6363
fmt.Println(err)
6464
ExitWithError = true

0 commit comments

Comments
 (0)