diff --git a/docs/configuration/statuses.md b/docs/configuration/statuses.md index fc9c76fbe..2b12e0ead 100644 --- a/docs/configuration/statuses.md +++ b/docs/configuration/statuses.md @@ -45,8 +45,8 @@ statuses-cleanup-cron: "0 1 * * 0" # Integer duration. # # Examples: ["6 months", "1 year", "2 years"] -# Default: "0" (i.e. disabled) -statuses-cleanup-remote-older-than: "0" +# Default: "0s" (i.e. disabled) +statuses-cleanup-remote-older-than: "0s" # Int. Maximum number of statuses a user can schedule at time. # Examples: [300] diff --git a/example/config.yaml b/example/config.yaml index 2f6ff86fc..cc06280ce 100644 --- a/example/config.yaml +++ b/example/config.yaml @@ -952,8 +952,8 @@ statuses-cleanup-cron: "0 1 * * 0" # Integer duration. # # Examples: ["6 months", "1 year", "2 years"] -# Default: "0" (i.e. disabled) -statuses-cleanup-remote-older-than: "0" +# Default: "0s" (i.e. disabled) +statuses-cleanup-remote-older-than: "0s" # Int. Maximum number of statuses a user can schedule at time. # Examples: [300] diff --git a/internal/cleaner/cleaner.go b/internal/cleaner/cleaner.go index 27d1023f0..e32520ab8 100644 --- a/internal/cleaner/cleaner.go +++ b/internal/cleaner/cleaner.go @@ -132,16 +132,20 @@ func (c *Cleaner) ScheduleJobs() error { panic("failed to schedule @mediacleanup") } - expr = config.GetStatusesCleanupCron() - log.Infof(nil, "scheduling statuses cleanup: %s", expr.Expr) + if _, dur := config.GetStatusesCleanupRemoteOlderThan().Duration(); dur > 0 { + expr = config.GetStatusesCleanupCron() + log.Infof(nil, "scheduling statuses cleanup: %s", expr.Expr) - // Schedule status cleaning by expr. - if !c.state.Workers.Scheduler.Add( - "@statuscleanup", - c.cleanStatuses, - expr, - ) { - panic("failed to schedule @statuscleanup") + // Schedule status cleaning by expr. + if !c.state.Workers.Scheduler.Add( + "@statuscleanup", + c.cleanStatuses, + expr, + ) { + panic("failed to schedule @statuscleanup") + } + } else { + log.Infof(nil, "skipping statuses cleanup scheduling, as statuses-cleanup-remote-older-than <= 0") } return nil