diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-05-01 16:52:27 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-05-01 16:52:27 +0200 |
commit | 392ca0472a50ea930f46e22dccf5ce55b04ef588 (patch) | |
tree | 9f8c6b3dcb11a620a417205f9554e8d37e5f3e12 /app/workers | |
parent | 252deefe3433d0cedafd973becd0d85b5182eb49 (diff) | |
parent | 33f3818d660c67194f94c7ff2bb180f4865e6748 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/packs/admin.js`: Conflicts due to glitch-soc's theming system. Upstream changes have been ported to `app/javascript/core/admin.js` - `app/models/trends/statuses.rb`: Minor conflict due to glitch-soc's option to allow CWed toots in trends. Ported upstream changes.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/scheduler/email_domain_block_refresh_scheduler.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/app/workers/scheduler/email_domain_block_refresh_scheduler.rb b/app/workers/scheduler/email_domain_block_refresh_scheduler.rb deleted file mode 100644 index e0ad89866..000000000 --- a/app/workers/scheduler/email_domain_block_refresh_scheduler.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class Scheduler::EmailDomainBlockRefreshScheduler - include Sidekiq::Worker - include Redisable - - sidekiq_options retry: 0 - - def perform - Resolv::DNS.open do |dns| - dns.timeouts = 5 - - EmailDomainBlock.find_each do |email_domain_block| - ips = begin - if ip?(email_domain_block.domain) - [email_domain_block.domain] - else - resources = dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::A).to_a + dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::AAAA).to_a - resources.map { |resource| resource.address.to_s } - end - end - - email_domain_block.update(ips: ips, last_refresh_at: Time.now.utc) - end - end - end - - def ip?(str) - str =~ Regexp.union([Resolv::IPv4::Regex, Resolv::IPv6::Regex]) - end -end |