Retrospring/app/workers/scheduler/inbox_cleanup_scheduler.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
381 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Scheduler::InboxCleanupScheduler
include Sidekiq::Worker
sidekiq_options retry: false
def perform
orphaned_entries = InboxEntry.where(question_id: nil).includes(:user)
orphaned_entries.each do |inbox|
logger.info "Deleting orphaned inbox entry #{inbox.id} from user #{inbox.user.id}"
inbox.destroy
end
end
end