demarches-normaliennes/app/jobs/cron/purge_stale_archives_job.rb
Colin Darie 197fa54ea4 fix(archives): purge stuck pending archives
Cf 0cb096b3d6440a4da05ca2902ed6fa72a93e6579
2022-07-27 15:26:59 +02:00

8 lines
242 B
Ruby

class Cron::PurgeStaleArchivesJob < Cron::CronJob
self.schedule_expression = "every 5 minutes"
def perform
Archive.stale(Archive::RETENTION_DURATION).destroy_all
Archive.stuck(Archive::MAX_DUREE_GENERATION).destroy_all
end
end