From 30ea984f9de6f8dc7578be0a94942a63ba4d3e77 Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Tue, 12 Apr 2022 15:31:04 +0200 Subject: [PATCH] [Bugfix] Fix backup creation timeout (#952) --- CHANGELOG.md | 1 + pkg/handlers/backup/arango_client_impl.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c3b79527..cb22b8d59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A) - (Feature) Allow configuration for securityContext.runAsUser value - (Bugfix) Fix Satellite collections in Agency +- (Bugfix) Fix backup creation timeout ## [1.2.9](https://github.com/arangodb/kube-arangodb/tree/1.2.9) (2022-03-30) - (Feature) Improve Kubernetes clientsets management diff --git a/pkg/handlers/backup/arango_client_impl.go b/pkg/handlers/backup/arango_client_impl.go index 5bf91a64e..d3d5417ed 100644 --- a/pkg/handlers/backup/arango_client_impl.go +++ b/pkg/handlers/backup/arango_client_impl.go @@ -75,8 +75,7 @@ func (ac *arangoClientBackupImpl) List() (map[driver.BackupID]driver.BackupMeta, } func (ac *arangoClientBackupImpl) Create() (ArangoBackupCreateResponse, error) { - ctx, cancel := context.WithTimeout(context.Background(), defaultArangoClientTimeout) - defer cancel() + dt := defaultArangoClientTimeout co := driver.BackupCreateOptions{} @@ -86,9 +85,13 @@ func (ac *arangoClientBackupImpl) Create() (ArangoBackupCreateResponse, error) { } if timeout := opt.Timeout; timeout != nil { co.Timeout = time.Duration(*timeout * float32(time.Second)) + dt += co.Timeout } } + ctx, cancel := context.WithTimeout(context.Background(), dt) + defer cancel() + id, resp, err := ac.driver.Backup().Create(ctx, &co) if err != nil { return ArangoBackupCreateResponse{}, err