5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 15:31:43 +00:00
panel/app/jobs/uri_collection_job.rb

18 lines
557 B
Ruby
Raw Normal View History

2021-10-20 16:08:21 +00:00
# frozen_string_literal: true
# Procesar una lista de URIs para una lista de dominios. Esto nos
# permite procesar estadísticas a demanada.
class UriCollectionJob < ApplicationJob
def perform(hostnames:, file:)
uris = File.read(file).split("\n")
hostnames.each do |hostname|
uris.each do |uri|
break if File.exist? Rails.root.join('tmp', 'uri_collection_job_stop')
AccessLog.where(host: hostname, uri: uri).completed_requests.non_robots.group(:host, :uri).rollup('host|uri', interval: 'day')
end
end
end
end