about summary refs log tree commit diff
path: root/app/workers/scheduler
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-08-05 17:04:42 -0500
committermultiple creatures <dev@multiple-creature.party>2019-08-05 17:04:42 -0500
commit2ff40d37880dbb3cff79a2179c544a3a4efe1691 (patch)
tree62568346e1df912d54012ef7f0fb0f14c84b79ff /app/workers/scheduler
parent39a58f406141fd0b21c8ab88366ec7f54f9ef7ae (diff)
janitor can now write suspended domains to whatever JANITOR_BLOCKLIST_OUTPUT is set to so they can be imported elsewhere (e.g., `nginx`)
Diffstat (limited to 'app/workers/scheduler')
-rw-r--r--app/workers/scheduler/janitor_scheduler.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/workers/scheduler/janitor_scheduler.rb b/app/workers/scheduler/janitor_scheduler.rb
index 05d62605e..4fff07587 100644
--- a/app/workers/scheduler/janitor_scheduler.rb
+++ b/app/workers/scheduler/janitor_scheduler.rb
@@ -22,6 +22,7 @@ class Scheduler::JanitorScheduler
     suspend_spammers!
     silence_markov!
     import_blocklists!
+    export_suspensions!
   end
 
   private
@@ -62,6 +63,15 @@ class Scheduler::JanitorScheduler
     end
   end
 
+  def export_suspensions!
+    outfile = ENV.fetch('JANITOR_BLOCKLIST_OUTPUT', '')
+    return if outfile.blank?
+    return unless File.file?(outfile)
+    File.open(outfile, 'w:UTF-8') do |file|
+      file.puts(DomainBlock.suspend.pluck(:domain))
+    end
+  end
+
 
   def spammer_accounts
     spammer_ids = spammer_account_ids