Skip to content

Commit

Permalink
Make disk usage best effort and log error
Browse files Browse the repository at this point in the history
  • Loading branch information
rugwirobaker committed May 17, 2022
1 parent 8d5f8cf commit d50f691
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/flycheck/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package flycheck

import (
"context"
"fmt"

chk "github.com/fly-examples/postgres-ha/pkg/check"
"github.com/fly-examples/postgres-ha/pkg/flypg"
Expand Down Expand Up @@ -29,8 +30,9 @@ func PostgreSQLRole(ctx context.Context, checks *chk.CheckSuite) (*chk.CheckSuit
checks.AddCheck("role", func() (string, error) {
// checkDisk usage is >90% return "readonly"
size, available, err := diskUsage("/data/")

if err != nil {
return "", errors.Wrap(err, "failed to get disk usage")
fmt.Printf("failed to get disk usage: %s\n", err)
}

used := float64(size-available) / float64(size) * 100
Expand Down

0 comments on commit d50f691

Please sign in to comment.