diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-24 17:49:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 17:49:20 +0800 |
commit | a666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch) | |
tree | 9ab1434b759a8a2cb275a83149903a823851e309 /services/cron/tasks_basic.go | |
parent | 4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff) | |
download | gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip |
Move user related model into models/user (#17781)
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
Diffstat (limited to 'services/cron/tasks_basic.go')
-rw-r--r-- | services/cron/tasks_basic.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/services/cron/tasks_basic.go b/services/cron/tasks_basic.go index 4832ca98a7..814f6eae4e 100644 --- a/services/cron/tasks_basic.go +++ b/services/cron/tasks_basic.go @@ -9,6 +9,7 @@ import ( "time" "code.gitea.io/gitea/models" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/auth" @@ -33,7 +34,7 @@ func registerUpdateMirrorTask() { }, PullLimit: 50, PushLimit: 50, - }, func(ctx context.Context, _ *models.User, cfg Config) error { + }, func(ctx context.Context, _ *user_model.User, cfg Config) error { umtc := cfg.(*UpdateMirrorTaskConfig) return mirror_service.Update(ctx, umtc.PullLimit, umtc.PushLimit) }) @@ -53,7 +54,7 @@ func registerRepoHealthCheck() { }, Timeout: 60 * time.Second, Args: []string{}, - }, func(ctx context.Context, _ *models.User, config Config) error { + }, func(ctx context.Context, _ *user_model.User, config Config) error { rhcConfig := config.(*RepoHealthCheckConfig) return repository_service.GitFsck(ctx, rhcConfig.Timeout, rhcConfig.Args) }) @@ -64,7 +65,7 @@ func registerCheckRepoStats() { Enabled: true, RunAtStart: true, Schedule: "@midnight", - }, func(ctx context.Context, _ *models.User, _ Config) error { + }, func(ctx context.Context, _ *user_model.User, _ Config) error { return models.CheckRepoStats(ctx) }) } @@ -77,7 +78,7 @@ func registerArchiveCleanup() { Schedule: "@midnight", }, OlderThan: 24 * time.Hour, - }, func(ctx context.Context, _ *models.User, config Config) error { + }, func(ctx context.Context, _ *user_model.User, config Config) error { acConfig := config.(*OlderThanConfig) return models.DeleteOldRepositoryArchives(ctx, acConfig.OlderThan) }) @@ -91,7 +92,7 @@ func registerSyncExternalUsers() { Schedule: "@midnight", }, UpdateExisting: true, - }, func(ctx context.Context, _ *models.User, config Config) error { + }, func(ctx context.Context, _ *user_model.User, config Config) error { realConfig := config.(*UpdateExistingConfig) return auth.SyncExternalUsers(ctx, realConfig.UpdateExisting) }) @@ -105,7 +106,7 @@ func registerDeletedBranchesCleanup() { Schedule: "@midnight", }, OlderThan: 24 * time.Hour, - }, func(ctx context.Context, _ *models.User, config Config) error { + }, func(ctx context.Context, _ *user_model.User, config Config) error { realConfig := config.(*OlderThanConfig) models.RemoveOldDeletedBranches(ctx, realConfig.OlderThan) return nil @@ -117,7 +118,7 @@ func registerUpdateMigrationPosterID() { Enabled: true, RunAtStart: true, Schedule: "@midnight", - }, func(ctx context.Context, _ *models.User, _ Config) error { + }, func(ctx context.Context, _ *user_model.User, _ Config) error { return migrations.UpdateMigrationPosterID(ctx) }) } @@ -132,7 +133,7 @@ func registerCleanupHookTaskTable() { CleanupType: "OlderThan", OlderThan: 168 * time.Hour, NumberToKeep: 10, - }, func(ctx context.Context, _ *models.User, config Config) error { + }, func(ctx context.Context, _ *user_model.User, config Config) error { realConfig := config.(*CleanupHookTaskConfig) return webhook.CleanupHookTaskTable(ctx, webhook.ToHookTaskCleanupType(realConfig.CleanupType), realConfig.OlderThan, realConfig.NumberToKeep) }) |