From 83b9325d0c76e74a5cf525df45eb67b660f0246e Mon Sep 17 00:00:00 2001 From: f Date: Sat, 23 Apr 2022 17:50:36 -0300 Subject: [PATCH] =?UTF-8?q?grabar=20la=20duraci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/uri_collection_job.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/jobs/uri_collection_job.rb b/app/jobs/uri_collection_job.rb index b66a804d..7ca9a4d9 100644 --- a/app/jobs/uri_collection_job.rb +++ b/app/jobs/uri_collection_job.rb @@ -19,9 +19,12 @@ class UriCollectionJob < PeriodicJob def perform(site_id:, once: true) @site = Site.find site_id + # Recordar la última vez que se corrió la tarea + stat = site.stats.create! name: STAT_NAME + hostnames.each do |hostname| uris.each do |uri| - return if stop? + next if stop? AccessLog.where(host: hostname, uri: uri) .where('created_at >= ?', beginning_of_interval) @@ -46,8 +49,7 @@ class UriCollectionJob < PeriodicJob end end - # Recordar la última vez que se corrió la tarea - site.stats.create! name: STAT_NAME + stat.touch run_again! unless once end