mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 15:31:43 +00:00
18 lines
557 B
Ruby
18 lines
557 B
Ruby
|
# 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
|