module QC::Config
Public Instance Methods
You can use the APP_NAME to query for postgres related process information in the pg_stat_activity table.
# File lib/queue_classic/config.rb, line 8 def app_name @app_name ||= ENV["QC_APP_NAME"] || "queue_classic" end
The default queue used by ‘QC.enqueue`.
# File lib/queue_classic/config.rb, line 31 def default_queue @default_queue ||= Queue.new(QC.queue) end
# File lib/queue_classic/config.rb, line 35 def default_queue=(queue) @default_queue = queue end
The worker class instantiated by QC’s rake tasks.
# File lib/queue_classic/config.rb, line 62 def default_worker_class @worker_class ||= (ENV["QC_DEFAULT_WORKER_CLASS"] && Kernel.const_get(ENV["QC_DEFAULT_WORKER_CLASS"]) || QC::Worker) end
# File lib/queue_classic/config.rb, line 68 def default_worker_class=(worker_class) @worker_class = worker_class end
Set this variable if you wish for the worker to fork a UNIX process for each locked job. Remember to re-establish any database connections. See the worker for more details.
# File lib/queue_classic/config.rb, line 57 def fork_worker? @fork_worker ||= (!ENV["QC_FORK_WORKER"].nil?) end
# File lib/queue_classic/config.rb, line 26 def queue @queue = ENV["QUEUE"] || "default" end
Each row in the table will have a column that notes the queue. You can point your workers at different queues.
# File lib/queue_classic/config.rb, line 42 def queues @queues ||= (ENV["QUEUES"] && ENV["QUEUES"].split(",").map(&:strip)) || [] end
reset memoized configuration
# File lib/queue_classic/config.rb, line 73 def reset_config # TODO: we might want to think about storing these in a Hash. @app_name = nil @wait_time = nil @table_name = nil @queue = nil @default_queue = nil @queues = nil @top_bound = nil @fork_worker = nil @worker_class = nil end
Why do you want to change the table name? Just deal with the default OK? If you do want to change this, you will need to update the PL/pgSQL lock_head() function. Come on. Don’t do it.… Just stick with the default.
# File lib/queue_classic/config.rb, line 22 def table_name @table_name ||= "queue_classic_jobs" end
Set this to 1 for strict FIFO. There is nothing special about 9.…
# File lib/queue_classic/config.rb, line 48 def top_bound @top_bound ||= (ENV["QC_TOP_BOUND"] || 9).to_i end
Number of seconds to block on the listen chanel for new jobs.
# File lib/queue_classic/config.rb, line 13 def wait_time @wait_time ||= (ENV["QC_LISTEN_TIME"] || 5).to_i end