From f216670814f1cd243196f2ea3a2db9fdcf826ed3 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 26 Apr 2020 21:42:41 -0700 Subject: [PATCH] use context specific to the etcd call (#9458) --- cmd/config-encrypted.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/config-encrypted.go b/cmd/config-encrypted.go index 102fdf5ea..4cac84aa1 100644 --- a/cmd/config-encrypted.go +++ b/cmd/config-encrypted.go @@ -21,6 +21,7 @@ import ( "context" "errors" "fmt" + "time" "unicode/utf8" etcd "github.com/coreos/etcd/clientv3" @@ -163,9 +164,6 @@ func decryptData(edata []byte, creds ...auth.Credentials) ([]byte, error) { } func migrateIAMConfigsEtcdToEncrypted(ctx context.Context, client *etcd.Client) error { - ctx, cancel := context.WithTimeout(ctx, defaultContextTimeout) - defer cancel() - encrypted, err := checkBackendEtcdEncrypted(ctx, client) if err != nil { return err @@ -206,7 +204,10 @@ func migrateIAMConfigsEtcdToEncrypted(ctx context.Context, client *etcd.Client) logger.Info("Attempting encryption of all IAM users and policies on etcd") } - r, err := client.Get(ctx, minioConfigPrefix, etcd.WithPrefix(), etcd.WithKeysOnly()) + listCtx, cancel := context.WithTimeout(ctx, 1*time.Minute) + defer cancel() + + r, err := client.Get(listCtx, minioConfigPrefix, etcd.WithPrefix(), etcd.WithKeysOnly()) if err != nil { return err }