summaryrefslogtreecommitdiffstats
path: root/modules/cron/tasks_basic.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/cron/tasks_basic.go')
-rw-r--r--modules/cron/tasks_basic.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/cron/tasks_basic.go b/modules/cron/tasks_basic.go
index a45704e889..391cda0f89 100644
--- a/modules/cron/tasks_basic.go
+++ b/modules/cron/tasks_basic.go
@@ -109,6 +109,22 @@ func registerUpdateMigrationPosterID() {
})
}
+func registerCleanupHookTaskTable() {
+ RegisterTaskFatal("cleanup_hook_task_table", &CleanupHookTaskConfig{
+ BaseConfig: BaseConfig{
+ Enabled: true,
+ RunAtStart: false,
+ Schedule: "@every 24h",
+ },
+ CleanupType: "OlderThan",
+ OlderThan: 168 * time.Hour,
+ NumberToKeep: 10,
+ }, func(ctx context.Context, _ *models.User, config Config) error {
+ realConfig := config.(*CleanupHookTaskConfig)
+ return models.CleanupHookTaskTable(ctx, models.ToHookTaskCleanupType(realConfig.CleanupType), realConfig.OlderThan, realConfig.NumberToKeep)
+ })
+}
+
func initBasicTasks() {
registerUpdateMirrorTask()
registerRepoHealthCheck()
@@ -119,4 +135,5 @@ func initBasicTasks() {
if !setting.Repository.DisableMigrations {
registerUpdateMigrationPosterID()
}
+ registerCleanupHookTaskTable()
}