lib/rocket_job/jobs/dirmon_job.rb in rocketjob-3.4.3 vs lib/rocket_job/jobs/dirmon_job.rb in rocketjob-3.5.0

- old
+ new

@@ -38,11 +38,11 @@ # Only allow one DirmonJob instance to be running at a time include RocketJob::Plugins::Singleton # Start a new job when this one completes, fails, or aborts include RocketJob::Plugins::Restart - self.priority = 40 + self.priority = 30 # Number of seconds between directory scans. Default 5 mins field :check_seconds, type: Float, default: 300.0, copy_on_restart: true # Hash[file_name, size] @@ -70,15 +70,14 @@ def check_directories new_file_names = {} DirmonEntry.enabled.each do |entry| entry.each do |pathname| # BSON Keys cannot contain periods - key = pathname.to_s.gsub('.', '_') - previous_size = previous_file_names[key] - if size = check_file(entry, pathname, previous_size) - new_file_names[key] = size - end + key = pathname.to_s.tr('.', '_') + previous_size = previous_file_names[key] + size = check_file(entry, pathname, previous_size) + new_file_names[key] = size if size end end self.previous_file_names = new_file_names end @@ -94,9 +93,8 @@ logger.info("Found file: #{pathname}. File size: #{size}") # Keep for the next run size end end - end end end