2024-01-20 05:48:57 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Scheduler::InboxCleanupScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
sidekiq_options retry: false
|
|
|
|
|
|
|
|
def perform
|
2024-01-27 04:02:58 -08:00
|
|
|
orphaned_entries = InboxEntry.where(question_id: nil).includes(:user)
|
2024-01-20 05:48:57 -08:00
|
|
|
orphaned_entries.each do |inbox|
|
|
|
|
logger.info "Deleting orphaned inbox entry #{inbox.id} from user #{inbox.user.id}"
|
|
|
|
inbox.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|