mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
16 lines
438 B
Ruby
16 lines
438 B
Ruby
class CleanupOldLeaderboardsJob < ApplicationJob
|
|
queue_as :literally_whenever # fucking wild that this exists
|
|
|
|
def perform
|
|
cutoff = 2.days.ago.beginning_of_day
|
|
|
|
old_leaderboards = Leaderboard.where("created_at < ?", cutoff)
|
|
count = old_leaderboards.count
|
|
return if count.zero?
|
|
|
|
old_leaderboards.destroy_all # kerblam!
|
|
|
|
Rails.logger.info "CleanupOldLeaderboardsJob: Deleted #{count} old leaderboards"
|
|
end
|
|
end
|