Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions cmd/flexctl/backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import (
"github.com/spf13/cobra"
)

const (
barmanCloudMetadataTimeout = 5 * time.Minute
barmanCloudBackupTimeout = 1 * time.Hour
)

var backupListCmd = &cobra.Command{
Use: "list",
Short: "Lists all backups",
Expand Down Expand Up @@ -66,7 +71,7 @@ var backupShowCmd = &cobra.Command{
func showBackup(cmd *cobra.Command, args []string) error {
id := args[0]

ctx, cancel := context.WithTimeout(cmd.Context(), 10*time.Second)
ctx, cancel := context.WithTimeout(cmd.Context(), barmanCloudMetadataTimeout)
defer cancel()

store, err := state.NewStore()
Expand All @@ -90,7 +95,7 @@ func showBackup(cmd *cobra.Command, args []string) error {
}

func createBackup(cmd *cobra.Command) error {
ctx, cancel := context.WithTimeout(cmd.Context(), 5*time.Minute)
ctx, cancel := context.WithTimeout(cmd.Context(), barmanCloudBackupTimeout)
defer cancel()

n, err := flypg.NewNode()
Expand Down Expand Up @@ -148,7 +153,7 @@ func createBackup(cmd *cobra.Command) error {
}

func listBackups(cmd *cobra.Command) error {
ctx, cancel := context.WithTimeout(cmd.Context(), 10*time.Second)
ctx, cancel := context.WithTimeout(cmd.Context(), barmanCloudMetadataTimeout)
defer cancel()

store, err := state.NewStore()
Expand All @@ -167,7 +172,7 @@ func listBackups(cmd *cobra.Command) error {
}

if isJSON {
jsonBytes, err := barman.ListRawBackups(cmd.Context())
jsonBytes, err := barman.ListRawBackups(ctx)
if err != nil {
return fmt.Errorf("failed to list backups: %v", err)
}
Expand Down
Loading