I'm new to rails so this is all new stuff to me.
I have an open issue titled, import finalizer daemon event loop needs to be slowed down.
In the description it says I need to slow it from running once every 0.1 seconds to every 1.0 seconds.
Like I said, I'm new so I'm not sure where to even begin here.
If it helps, heres the code in lib/daemons/app_name_import.rb
#!/usr/bin/env ruby
require 'newrelic_rpm'
require 'pmppulse'
# ENV["RAILS_ENV"] ||= "development" if Socket.gethostname =~ /-mac.office.appriss.com/
raise 'ENV["RAILS_ENV"] undefined' if ENV["RAILS_ENV"].nil?
root = File.expand_path(File.dirname(__FILE__))
root = File.dirname(root) until File.exists?(File.join(root, 'config'))
Dir.chdir(root)
require File.join(root, "config", "environment")
# Inherits other configuration options from rails environment
PMPPulse.configure do |config|
config.component = 'clearinghouse_import_daemon'
config.preferences_path = '/tmp/pmpaware_ch_import_daemon_config.yml'
end
require File.join(root, "script", "eventmachine", "importer.rb")
def close_down signal
Rails.logger.info "ddm import from ASAP daemon is shutting down at #{Time.now}.\n"
Importer.shutdown signal
until Importer.safe_to_shutdown?
sleep 0.1
end
end
at_exit { PMPPulse.shutdown }
#Define this so we don't get an exception about it not being defined...
def close
end
Signal.trap("SIGINT") do
#Have to get out of the trap context...
Thread.new do
close_down "SIGINT"
end.join
end
Signal.trap("SIGTERM") do
#Have to get out of the trap context...
Thread.new do
close_down "SIGTERM"
end.join
end
Rails.logger.info "clearinghouse_import: daemon is running at #{Time.now}.\n"
PMPPulse.startup
Importer.new #start the importer
... and here's the code from lib/daemons/app_name_import_ctl (what is this file?)
#!/usr/bin/env ruby
require 'rubygems'
require "daemons"
require "daemons/rails/config"
require File.join(File.dirname(File.absolute_path(__FILE__)),'..','..','config','appriss_static.rb')
config = Daemons::Rails::Config.for_controller(File.expand_path(__FILE__))
app_name = "#{File.dirname(__FILE__)}/#{ENV['RAILS_ENV']}.#{File.basename(config[:script])}"
File.symlink config[:script], app_name unless File.symlink? app_name
config[:app_name] = File.basename(app_name)
Daemons.run config[:script], config.to_hash
Aucun commentaire:
Enregistrer un commentaire