Skip to content

Commit

Permalink
fix: Add delay for WaitUntilAvailable
Browse files Browse the repository at this point in the history
  • Loading branch information
matbme committed Mar 18, 2024
1 parent 90a35bb commit 841eaad
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions core/disk/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"slices"
"strings"
"time"

luks "github.com/vanilla-os/albius/core/disk/luks"
"github.com/vanilla-os/albius/core/util"
Expand Down Expand Up @@ -319,9 +320,6 @@ func LUKSSetLabel(part *Partition, name string) error {
// This is particularly useful to make sure a recently created or modified
// partition is recognized by the system.
func (part *Partition) WaitUntilAvailable() {
// maxTimeout := 1000
// timeout := 0

for {
_, err := os.Stat(part.Path)
if !os.IsNotExist(err) {
Expand All @@ -333,13 +331,12 @@ func (part *Partition) WaitUntilAvailable() {
if uuid, err := part.GetUUID(); err != nil && uuid != "" {
return
}

fmt.Println("Partition does not have UUID, retrying...")
} else {
fmt.Println("Partition not found, retrying...")
}
// time.Sleep(50 * time.Millisecond)
//
// timeout += 1
// if timeout == maxTimeout {
// // We can't recover from this, so just panic
// panic(fmt.Sprintf("Timed out waiting for partition %s", part.Path))
// }

time.Sleep(50 * time.Millisecond)
}
}

0 comments on commit 841eaad

Please sign in to comment.