From d32681557eae1e9f2ab1f2f7598a1339cbde8ce7 Mon Sep 17 00:00:00 2001 From: jolestar Date: Mon, 27 Mar 2017 11:52:32 +0800 Subject: [PATCH] set default WaitInterval. --- client/client.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/client/client.go b/client/client.go index 18d45ff..f4eb104 100644 --- a/client/client.go +++ b/client/client.go @@ -11,17 +11,17 @@ import ( const ( //InstanceStatusPending pending - InstanceStatusPending = "pending" + InstanceStatusPending = "pending" //InstanceStatusRunning running - InstanceStatusRunning = "running" + InstanceStatusRunning = "running" //InstanceStatusStopped stopped - InstanceStatusStopped = "stopped" + InstanceStatusStopped = "stopped" //InstanceStatusSuspended suspended - InstanceStatusSuspended = "suspended" + InstanceStatusSuspended = "suspended" //InstanceStatusTerminated terminated InstanceStatusTerminated = "terminated" //InstanceStatusCeased ceased - InstanceStatusCeased = "ceased" + InstanceStatusCeased = "ceased" //LoadBalancerStatusPending pending LoadBalancerStatusPending = "pending" @@ -36,7 +36,8 @@ const ( //LoadBalancerStatusCeased ceased LoadBalancerStatusCeased = "ceased" - defaultOpTimeout = 180*time.Second + defaultOpTimeout = 180 * time.Second + defaultWaitInterval = 5 * time.Second ) // QingCloudClient QingCloud IaaS Advanced Client @@ -66,10 +67,11 @@ func NewClient(config *config.Config, zone string) (QingCloudClient, error) { } c := &client{ - InstanceService: instanceService, - JobService: jobService, - OperationTimeout: defaultOpTimeout, - zone: zone, + InstanceService: instanceService, + JobService: jobService, + OperationTimeout: defaultOpTimeout, + WaitInterval: defaultWaitInterval, + zone: zone, } return c, nil } @@ -78,7 +80,7 @@ type client struct { InstanceService *service.InstanceService JobService *service.JobService OperationTimeout time.Duration - WaitInterval time.Duration + WaitInterval time.Duration zone string }