Browse Source

GCS: allow a 10 seconds timeout for client creation

Signed-off-by: Nicola Murino <[email protected]>
Nicola Murino 9 months ago
parent
commit
d18e1ba3d9
1 changed files with 3 additions and 1 deletions
  1. 3 1
      internal/vfs/gcsfs.go

+ 3 - 1
internal/vfs/gcsfs.go

@@ -87,7 +87,9 @@ func NewGCSFs(connectionID, localTempDir, mountPath string, config GCSFsConfig)
 	if err = fs.config.validate(); err != nil {
 		return fs, err
 	}
-	ctx := context.Background()
+	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+	defer cancel()
+
 	if fs.config.AutomaticCredentials > 0 {
 		fs.svc, err = storage.NewClient(ctx)
 	} else {