Skip to content

Commit

Permalink
Merge branch '292-disable-data-collection' into 'development'
Browse files Browse the repository at this point in the history
Resolve "disable data collection"

Closes #292

See merge request ComPlat/chemotion_ELN!501
  • Loading branch information
PiTrem committed Nov 8, 2017
2 parents 335a3df + 21e6d9c commit 4c77f7e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions config/initializers/delayed_job_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@
# Delayed::Worker.raise_signal_exceptions = :term
Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))

if Rails.env.production? && Delayed::Job.column_names.include?('cron')
if Rails.configuration.respond_to?(:datamailcollector)
CollectDataFromMailJob.set(cron: '*/15 * * * *').perform_later if Delayed::Job.where("handler like ?", "%CollectDataFromMailJob%").empty?
else
begin
if ActiveRecord::Base.connection.table_exists?('delayed_jobs') && Delayed::Job.column_names.include?('cron')
Delayed::Job.where("handler like ?", "%CollectDataFromMailJob%").destroy_all
end

if Rails.configuration.respond_to?(:datacollector)
CollectDataFromDevicesJob.set(cron: '*/5 * * * *').perform_later if Delayed::Job.where("handler like ?", "%CollectDataFromDevicesJob%").empty?
else
Delayed::Job.where("handler like ?", "%CollectDataFromDevicesJob%").destroy_all
end
rescue PG::ConnectionBad => e
puts e.message
end

0 comments on commit 4c77f7e

Please sign in to comment.