mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
async black box
This commit is contained in:
parent
e4c580564b
commit
a2a46d406e
2 changed files with 14 additions and 4 deletions
|
@ -1781,10 +1781,7 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
if pathname.extname.match(HTML_REGEX) && defined?(BlackBox)
|
||||
begin
|
||||
BlackBox.tos_violation_check self, uploaded
|
||||
rescue
|
||||
end
|
||||
BlackBoxWorker.perform_async values[:id], relative_path
|
||||
end
|
||||
|
||||
relative_path_dir = Pathname(relative_path).dirname
|
||||
|
|
13
workers/black_box_worker.rb
Normal file
13
workers/black_box_worker.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class BlackBoxWorker
|
||||
include Sidekiq::Worker
|
||||
sidekiq_options queue: :black_box, retry: 10, backtrace: true
|
||||
|
||||
def perform(site_id, path)
|
||||
site = Site[site_id]
|
||||
return true if site.nil? || site.is_banned? || site.is_deleted
|
||||
BlackBox.tos_violation_check site, path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# BlackBox.tos_violation_check self, uploaded
|
Loading…
Add table
Reference in a new issue