lib/rocket_job/jobs/dirmon_job.rb in rocketjob-0.9.1 vs lib/rocket_job/jobs/dirmon_job.rb in rocketjob-1.0.0

- old
+ new

@@ -94,11 +94,11 @@ # Checks if a file should result in starting a job # Returns [Integer] file size, or nil if the file started a job def check_file(entry, file_name, previous_size) size = File.size(file_name) if previous_size && (previous_size == size) - logger.info("File stabilized: #{file_name}. Starting: #{entry.job}") + logger.info("File stabilized: #{file_name}. Starting: #{entry.job_name}") start_job(entry, file_name) nil else logger.info("Found file: #{file_name}. File size: #{size}") # Keep for the next run @@ -109,11 +109,12 @@ nil end # Starts the job for the supplied entry def start_job(entry, file_name) - entry.job.constantize.perform_later(*entry.arguments) do |job| - # Set properties, also allows :perform_method to be overridden + entry.job_class.perform_later(*entry.arguments) do |job| + job.perform_method = entry.perform_method + # Set properties entry.properties.each_pair { |k, v| job.send("#{k}=".to_sym, v) } upload_file(job, file_name, entry.archive_directory) end end