Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KT Cloud VPC] Add time.Sleep to Prevent Errors after each Firewall Rule Creation API call #1212

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ func (vmHandler *KTVpcVMHandler) createPortForwardingFirewallRules(vpcIID irs.II

cblogger.Info("### Waiting for FireWall 'inbound' Rules to be Created(600sec) !!")

// To prevent - json: cannot unmarshal string into Go struct field AsyncJobResult.nc_queryasyncjobresultresponse.result of type job.JobResult
// $$$ To prevent - json: cannot unmarshal string into Go struct field AsyncJobResult.nc_queryasyncjobresultresponse.result of type job.JobResult
time.Sleep(time.Second * 3)

jobWaitErr := vmHandler.waitForAsyncJob(fwResult.JopID, 600000000000)
Expand Down Expand Up @@ -1072,6 +1072,10 @@ func (vmHandler *KTVpcVMHandler) createPortForwardingFirewallRules(vpcIID irs.II
// cblogger.Info("\n")

cblogger.Info("### Waiting for FireWall 'outbound' Rules to be Created(600sec) !!")

// $$$ To prevent - json: cannot unmarshal string into Go struct field AsyncJobResult.nc_queryasyncjobresultresponse.result of type job.JobResult
time.Sleep(time.Second * 3)

jobWaitErr := vmHandler.waitForAsyncJob(fwResult.JopID, 600000000000)
if jobWaitErr != nil {
cblogger.Errorf("Failed to Wait the Job : [%v]", jobWaitErr)
Expand Down Expand Up @@ -1147,7 +1151,6 @@ func (vmHandler *KTVpcVMHandler) mappingVMInfo(vm servers.Server) (irs.VMInfo, e
cblogger.Debug(getSGErr)
// return irs.VMInfo{}, getSGErr
}

if countSgKvList(*sgInfo) > 0 {
// Since S/G is managed as a file, the systemID is the same as the name ID.
var sgIIDs []irs.IID
Expand Down Expand Up @@ -1815,7 +1818,7 @@ func (vmHandler *KTVpcVMHandler) waitForAsyncJob(jobId string, timeOut time.Dura
}

// Wait 3 seconds between requests
time.Sleep(5 * time.Second)
time.Sleep(3 * time.Second)

// Verify whether we shouldn't exit or ...
select {
Expand Down
Loading