mirror of
https://github.com/postalserver/postal.git
synced 2026-10-18 18:26:06 +00:00
feat: new background work process
This removes all previous dependencies on RabbitMQ and the need to run separate cron and requeueing processes.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CheckAllDNSScheduledTask < ApplicationScheduledTask
|
||||
|
||||
def call
|
||||
Domain.where.not(dns_checked_at: nil).where("dns_checked_at <= ?", 1.hour.ago).each do |domain|
|
||||
logger.info "checking DNS for domain: #{domain.name}"
|
||||
domain.check_dns(:auto)
|
||||
end
|
||||
|
||||
TrackDomain.where("dns_checked_at IS NULL OR dns_checked_at <= ?", 1.hour.ago).includes(:domain).each do |domain|
|
||||
logger.info "checking DNS for track domain: #{domain.full_name}"
|
||||
domain.check_dns
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user