diff --git a/.env.production.sample b/.env.production.sample index 0df0a87786..5bf4d9f272 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -286,6 +286,14 @@ MAX_POLL_OPTION_CHARS=100 MAX_EMOJI_SIZE=51200 MAX_REMOTE_EMOJI_SIZE=204800 +# IP retention period +# If undefined, the value of 31556952 (1 average year) will be used. +# Keep in mind that this is period will not be completely accurate +# and may have a delay of up to 24 hours on vanilla and glitch-soc Mastodon +# due to the scheduling of ip_cleanup_scheduler in sidekiq.yml. +# Time unit in seconds +IP_RETENTION_PERIOD=31556952 + # Optional hCaptcha support # HCAPTCHA_SECRET_KEY= # HCAPTCHA_SITE_KEY= diff --git a/app/workers/scheduler/ip_cleanup_scheduler.rb b/app/workers/scheduler/ip_cleanup_scheduler.rb index 7afad2f581..5a4a7bc2fe 100644 --- a/app/workers/scheduler/ip_cleanup_scheduler.rb +++ b/app/workers/scheduler/ip_cleanup_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::IpCleanupScheduler include Sidekiq::Worker - IP_RETENTION_PERIOD = 1.year.freeze + IP_RETENTION_PERIOD = ENV.fetch('IP_RETENTION_PERIOD', 1.year).to_i.freeze sidekiq_options retry: 0 diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 2a38714684..71a90e0acf 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -46,7 +46,7 @@ class: Scheduler::UserCleanupScheduler queue: scheduler ip_cleanup_scheduler: - cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *' + every: '1h' class: Scheduler::IpCleanupScheduler queue: scheduler email_scheduler: