0
0
Fork 0

Remove digest e-mails (#17985)

* Remove digest e-mails

* Remove digest-related code
This commit is contained in:
Eugen Rochko 2022-08-25 23:38:22 +02:00 committed by GitHub
parent 5b0e8cc92b
commit 0b3e4fd5de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 1 additions and 214 deletions

View file

@ -1,25 +0,0 @@
# frozen_string_literal: true
class Scheduler::EmailScheduler
include Sidekiq::Worker
sidekiq_options retry: 0
FREQUENCY = 7.days.freeze
SIGN_IN_OFFSET = 1.day.freeze
def perform
eligible_users.reorder(nil).find_each do |user|
next unless user.allows_digest_emails?
DigestMailerWorker.perform_async(user.id)
end
end
private
def eligible_users
User.emailable
.where('current_sign_in_at < ?', (FREQUENCY + SIGN_IN_OFFSET).ago)
.where('last_emailed_at IS NULL OR last_emailed_at < ?', FREQUENCY.ago)
end
end