Skip to content

Commit 5c3d342

Browse files
authored
Added session Keep Alive logic (#3479)
1 parent 6a27467 commit 5c3d342

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/common/cns-lib/vsphere/virtualcenter.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ func (vc *VirtualCenter) NewClient(ctx context.Context, useragent string) (*govm
194194
log.Errorf("failed to create new client with err: %v", err)
195195
return nil, nil, err
196196
}
197+
198+
// Invoke KeepAlive on the vimClient RoundTripper to keep the connection alive
199+
// every 10 minutes.
200+
vimClient.RoundTripper = session.KeepAlive(vimClient.RoundTripper, 10*time.Minute)
197201
err = vimClient.UseServiceVersion("vsan")
198202
if err != nil && vc.Config.Host != "127.0.0.1" {
199203
// Skipping error for simulator connection for unit tests.

0 commit comments

Comments
 (0)