Move registerActionsCleanup
to initActionsTasks
(#31721)
There's already `initActionsTasks`; it will avoid additional check for if Actions enabled to move `registerActionsCleanup` into it. And we don't really need `OlderThanConfig`. (cherry picked from commit f989f464386139592b6911cad1be4c901eb97fe5)
This commit is contained in:
parent
92fbc8e216
commit
43b184cf07
3 changed files with 12 additions and 20 deletions
|
@ -19,6 +19,7 @@ func initActionsTasks() {
|
|||
registerStopEndlessTasks()
|
||||
registerCancelAbandonedJobs()
|
||||
registerScheduleTasks()
|
||||
registerActionsCleanup()
|
||||
}
|
||||
|
||||
func registerStopZombieTasks() {
|
||||
|
@ -63,3 +64,13 @@ func registerScheduleTasks() {
|
|||
return actions_service.StartScheduleTasks(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func registerActionsCleanup() {
|
||||
RegisterTaskFatal("cleanup_actions", &BaseConfig{
|
||||
Enabled: true,
|
||||
RunAtStart: true,
|
||||
Schedule: "@midnight",
|
||||
}, func(ctx context.Context, _ *user_model.User, _ Config) error {
|
||||
return actions_service.Cleanup(ctx)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue