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

请求提示超时 #9

Open
GLWJP opened this issue Oct 31, 2023 · 0 comments
Open

请求提示超时 #9

GLWJP opened this issue Oct 31, 2023 · 0 comments

Comments

@GLWJP
Copy link

GLWJP commented Oct 31, 2023

&{Success:false RequestId:--No RequestId-- ErrorCode:BadRequest ErrorMessage:Post "http://ap-guangzhou.cls.tencentcs.com/structuredlog?topic_id=xxxxxxxxxxx": context deadline exceeded (Client.Timeout exceeded while awaiting headers) TimeStampMs:1698742072412}

按照示例代码,修改循环的次数,大部分成功推送,但是部分出现上面的报错信息,可以怎么避免

注:dataMap 的长度为 26w
代码如下:
dataMap := make([]map[string]string, 0)
// 异步发送程序,需要启动
producerInstance.Start()

var m sync.WaitGroup
callBack := &Callback{}
for _, item := range dataMap {
	m.Add(1)
	go func(logMap map[string]string) {
		defer m.Done()
		log := tencentcloud_cls_sdk_go.NewCLSLog(time.Now().Unix(), logMap)
		err = producerInstance.SendLog(topicId, log, callBack)
		if err != nil {
			fmt.Println(err)
		}
	}(item)

}
m.Wait()
producerInstance.Close(60000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant