fix(cache): 修正日志预取时时间递增方向错误
- 修改获取Redis日志失败时时间递增逻辑,改为递减1分钟 - 调整空日志判断时时间递增为递减1分钟 - 修正日志解析失败时时间递增为递减1分钟 - 防止因时间递增错误导致的循环逻辑异常
This commit is contained in:
@@ -49,12 +49,12 @@ func (s *sCamelOil) GetPrefetchOrderLogs(ctx context.Context, req *v1.GetPrefetc
|
||||
logData, err2 := cache.NewCache().Get(ctx, redisKey)
|
||||
if err2 != nil {
|
||||
glog.Warningf(ctx, "获取Redis日志失败,key: %s, error: %v", redisKey, err)
|
||||
currentTime = currentTime.Add(time.Minute)
|
||||
currentTime = currentTime.Add(-gtime.M)
|
||||
continue
|
||||
}
|
||||
|
||||
if logData.IsEmpty() {
|
||||
currentTime = currentTime.Add(time.Minute)
|
||||
currentTime = currentTime.Add(-gtime.M)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func (s *sCamelOil) GetPrefetchOrderLogs(ctx context.Context, req *v1.GetPrefetc
|
||||
var minuteLogs []map[string]interface{}
|
||||
if err := json.Unmarshal([]byte(logData.String()), &minuteLogs); err != nil {
|
||||
glog.Warningf(ctx, "解析日志数据失败,key: %s, error: %v", redisKey, err)
|
||||
currentTime = currentTime.Add(time.Minute)
|
||||
currentTime = currentTime.Add(-gtime.M)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user