Browse Source

Merge pull request '强制用户统计在项目统计之后执行' (#817) from download-model-error into V20211115

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/817
Reviewed-by: ychao_1983 <ychao_1983@sina.com>
pull/829/head
ychao_1983 3 years ago
parent
commit
cda076aa00
2 changed files with 12 additions and 21 deletions
  1. +4
    -15
      modules/cron/tasks_basic.go
  2. +8
    -6
      routers/repo/repo_statistic.go

+ 4
- 15
modules/cron/tasks_basic.go View File

@@ -164,13 +164,13 @@ func registerHandleBlockChainUnSuccessCommits() {
})
}

func registerHandleRepoStatistic() {
RegisterTaskFatal("handle_repo_statistic", &BaseConfig{
func registerHandleRepoAndUserStatistic() {
RegisterTaskFatal("handle_repo_and_user_statistic", &BaseConfig{
Enabled: true,
RunAtStart: false,
Schedule: "@daily",
}, func(ctx context.Context, _ *models.User, _ Config) error {
repo.RepoStatisticAuto()
repo.StatisticAuto()
return nil
})
}
@@ -185,16 +185,6 @@ func registerHandleSummaryStatistic() {
return nil
})
}
func registerHandleUserStatistic() {
RegisterTaskFatal("handle_user_statistic", &BaseConfig{
Enabled: true,
RunAtStart: false,
Schedule: "@daily",
}, func(ctx context.Context, _ *models.User, _ Config) error {
repo.TimingCountData()
return nil
})
}

func registerHandleClearRepoStatisticFile() {
RegisterTaskFatal("handle_repo_clear_statistic_file", &BaseConfig{
@@ -222,7 +212,6 @@ func initBasicTasks() {
registerHandleBlockChainMergedPulls()
registerHandleBlockChainUnSuccessCommits()

registerHandleRepoStatistic()
registerHandleUserStatistic()
registerHandleRepoAndUserStatistic()
registerHandleSummaryStatistic()
}

+ 8
- 6
routers/repo/repo_statistic.go View File

@@ -3,18 +3,20 @@ package repo
import (
"time"

"code.gitea.io/gitea/modules/setting"

"code.gitea.io/gitea/modules/normalization"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/normalization"
"code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
)

//auto daily or manually
func StatisticAuto() {
RepoStatisticAuto()
TimingCountData()
}

//auto daily
func RepoStatisticAuto() {
log.Info("", time.Now())
yesterday := time.Now().AddDate(0, 0, -1).Format("2006-01-02")
setting.UpdateRadarMap()
RepoStatisticDaily(yesterday)


Loading…
Cancel
Save