Skip to content

Commit

Permalink
fix: Support retry after overclocking (#2760)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitmkn authored Aug 9, 2024
1 parent c4dfa3e commit b6e5577
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tencentcloud/services/tem/service_tencentcloud_tem.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,9 @@ func (me *TemService) DeleteTemLogConfigById(ctx context.Context, environmentId

func (me *TemService) DescribeTemScaleRule(ctx context.Context, environmentId string, applicationId string, scaleRuleId string) (scaleRule *tem.Autoscaler, errRet error) {
var (
logId = tccommon.GetLogId(ctx)
request = tem.NewDescribeApplicationAutoscalerListRequest()
logId = tccommon.GetLogId(ctx)
request = tem.NewDescribeApplicationAutoscalerListRequest()
response = tem.NewDescribeApplicationAutoscalerListResponse()
)

defer func() {
Expand All @@ -339,15 +340,21 @@ func (me *TemService) DescribeTemScaleRule(ctx context.Context, environmentId st
request.EnvironmentId = &environmentId
request.ApplicationId = &applicationId

response, err := me.client.UseTemClient().DescribeApplicationAutoscalerList(request)
err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := me.client.UseTemClient().DescribeApplicationAutoscalerList(request)
if e != nil {
return tccommon.RetryError(e)
} else {
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
}
response = result
return nil
})
if err != nil {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n",
logId, request.GetAction(), request.ToJsonString(), err.Error())
errRet = err
return
return nil, err
}
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())

scaleRuleList := response.Response.Result
for _, rule := range scaleRuleList {
if *rule.AutoscalerId == scaleRuleId {
Expand Down

0 comments on commit b6e5577

Please sign in to comment.