1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-28 03:28:13 +00:00

feat: optimize log indexes

This commit is contained in:
Jason Song
2022-10-18 17:17:58 +08:00
parent bb4963fd4a
commit dd5b2c5dfd
7 changed files with 59 additions and 25 deletions

View File

@@ -186,8 +186,11 @@ func (s *Service) UpdateLog(
return nil, status.Errorf(codes.Internal, "write logs: %v", err)
}
task.LogLength += int64(len(rows))
if task.LogIndexes == nil {
task.LogIndexes = &bots_model.LogIndexes{}
}
for _, n := range ns {
task.LogIndexes = append(task.LogIndexes, task.LogSize)
*task.LogIndexes = append(*task.LogIndexes, task.LogSize)
task.LogSize += int64(n)
}
if err := bots_model.UpdateTask(ctx, task, "log_indexes", "log_length", "log_size"); err != nil {