发送时额外增加超时时间, 每5000条+1秒

This commit is contained in:
2025-10-30 16:24:44 +08:00
parent cdcdac3531
commit 9c99508bdd
2 changed files with 4 additions and 3 deletions

View File

@@ -390,7 +390,7 @@ func (sdk *SDK) flush() {
// 发送消息
func (sdk *SDK) send(logs []GameLog) {
waitSecond := time.Duration(sdk.sdkConfig.FlushInterval/4) * time.Second
waitSecond := time.Duration(sdk.sdkConfig.FlushInterval/4)*time.Second + time.Second*time.Duration(gconv.Int(len(logs)/5000))
timeoutCtx, cancel := context.WithTimeout(context.Background(), waitSecond)
defer cancel()
data := make([][]any, 0, len(logs))

View File

@@ -15,7 +15,8 @@ func TestGamelog(t *testing.T) {
glsdk, err := gamelog.INIT(&gamelog.SDKConfig{
// 必填
Pid: "test5", // 项目ID
BaseUrl: "http://47.76.178.47:10101", // 香港测试服上报地址
// BaseUrl: "http://47.76.178.47:10101", // 香港测试服上报地址
BaseUrl: "http://101.37.28.111:10101", // 香港测试服上报地址
// BaseUrl: "http://127.0.0.1:10101", // 本次测试上报地址
ReportSk: "sngame2025", // xor混淆key
FlushInterval: 5, // 上报间隔