mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 18:46:22 +00:00
detener la tarea
This commit is contained in:
parent
22742cf058
commit
9b2194ee95
2 changed files with 9 additions and 1 deletions
|
@ -52,4 +52,12 @@ class PeriodicJob < ApplicationJob
|
||||||
def beginning_of_interval
|
def beginning_of_interval
|
||||||
@beginning_of_interval ||= last_stat.created_at.try(:"beginning_of_#{starting_interval}")
|
@beginning_of_interval ||= last_stat.created_at.try(:"beginning_of_#{starting_interval}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stop_file
|
||||||
|
@stop_file ||= Rails.root.join('tmp', self.class.to_s.tableize)
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop?
|
||||||
|
File.exist? stop_file
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ class UriCollectionJob < PeriodicJob
|
||||||
|
|
||||||
hostnames.each do |hostname|
|
hostnames.each do |hostname|
|
||||||
uris.each do |uri|
|
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)
|
AccessLog.where(host: hostname, uri: uri)
|
||||||
.where('created_at >= ?', beginning_of_interval)
|
.where('created_at >= ?', beginning_of_interval)
|
||||||
|
|
Loading…
Reference in a new issue