mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-26 18:23:41 +01:00
cb5b5cb5f7
* No need to re-require sidekiq plugins, they are required via Gemfile * Add derailed_benchmarks tool, no need to require TTY gems in Gemfile * Replace ruby-oembed with FetchOEmbedService Reduce startup by 45382 allocated objects * Remove preloaded JSON-LD in favour of caching HTTP responses Reduce boot RAM by about 6 MiB * Fix tests * Fix test suite by stubbing out JSON-LD contexts
23 lines
565 B
Ruby
23 lines
565 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Scheduler::EmailScheduler
|
|
include Sidekiq::Worker
|
|
|
|
def perform
|
|
eligible_users.find_each do |user|
|
|
next unless user.allows_digest_emails?
|
|
DigestMailerWorker.perform_async(user.id)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def eligible_users
|
|
User.confirmed
|
|
.joins(:account)
|
|
.where(accounts: { silenced: false, suspended: false })
|
|
.where(disabled: false)
|
|
.where('current_sign_in_at < ?', 20.days.ago)
|
|
.where('last_emailed_at IS NULL OR last_emailed_at < ?', 20.days.ago)
|
|
end
|
|
end
|