@@ -15,6 +15,11 @@ import (
1515 "github.com/spf13/cobra"
1616)
1717
18+ const (
19+ barmanCloudMetadataTimeout = 5 * time .Minute
20+ barmanCloudBackupTimeout = 1 * time .Hour
21+ )
22+
1823var backupListCmd = & cobra.Command {
1924 Use : "list" ,
2025 Short : "Lists all backups" ,
@@ -66,7 +71,7 @@ var backupShowCmd = &cobra.Command{
6671func showBackup (cmd * cobra.Command , args []string ) error {
6772 id := args [0 ]
6873
69- ctx , cancel := context .WithTimeout (cmd .Context (), 10 * time . Second )
74+ ctx , cancel := context .WithTimeout (cmd .Context (), barmanCloudMetadataTimeout )
7075 defer cancel ()
7176
7277 store , err := state .NewStore ()
@@ -90,7 +95,7 @@ func showBackup(cmd *cobra.Command, args []string) error {
9095}
9196
9297func createBackup (cmd * cobra.Command ) error {
93- ctx , cancel := context .WithTimeout (cmd .Context (), 5 * time . Minute )
98+ ctx , cancel := context .WithTimeout (cmd .Context (), barmanCloudBackupTimeout )
9499 defer cancel ()
95100
96101 n , err := flypg .NewNode ()
@@ -148,7 +153,7 @@ func createBackup(cmd *cobra.Command) error {
148153}
149154
150155func listBackups (cmd * cobra.Command ) error {
151- ctx , cancel := context .WithTimeout (cmd .Context (), 10 * time . Second )
156+ ctx , cancel := context .WithTimeout (cmd .Context (), barmanCloudMetadataTimeout )
152157 defer cancel ()
153158
154159 store , err := state .NewStore ()
@@ -167,7 +172,7 @@ func listBackups(cmd *cobra.Command) error {
167172 }
168173
169174 if isJSON {
170- jsonBytes , err := barman .ListRawBackups (cmd . Context () )
175+ jsonBytes , err := barman .ListRawBackups (ctx )
171176 if err != nil {
172177 return fmt .Errorf ("failed to list backups: %v" , err )
173178 }
0 commit comments