mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 10:31:41 +00:00
procesar uris a demanda
This commit is contained in:
parent
849ee4491c
commit
9cf7c62861
1 changed files with 17 additions and 0 deletions
17
app/jobs/uri_collection_job.rb
Normal file
17
app/jobs/uri_collection_job.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# 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
|
Loading…
Reference in a new issue