5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-05-19 04:00:49 +00:00

detener la tarea

This commit is contained in:
f 2022-04-23 15:24:06 -03:00
parent 22742cf058
commit 9b2194ee95
2 changed files with 9 additions and 1 deletions

View file

@ -52,4 +52,12 @@ class PeriodicJob < ApplicationJob
def beginning_of_interval
@beginning_of_interval ||= last_stat.created_at.try(:"beginning_of_#{starting_interval}")
end
def stop_file
@stop_file ||= Rails.root.join('tmp', self.class.to_s.tableize)
end
def stop?
File.exist? stop_file
end
end

View file

@ -21,7 +21,7 @@ class UriCollectionJob < PeriodicJob
hostnames.each do |hostname|
uris.each do |uri|
return if File.exist? Rails.root.join('tmp', 'uri_collection_job_stop')
return if stop?
AccessLog.where(host: hostname, uri: uri)
.where('created_at >= ?', beginning_of_interval)