lib/rocket_job/server.rb in rocketjob-3.0.0.beta vs lib/rocket_job/server.rb in rocketjob-3.0.0.beta2

- old
+ new

@@ -36,11 +36,11 @@ # at the time the server unexpectedly terminated, if any field :name, type: String, default: -> { "#{SemanticLogger.host}:#{$$}" } # The maximum number of workers this server should start # If set, it will override the default value in RocketJob::Config - field :max_workers, type: Integer, default: -> { Config.instance.max_worker_threads } + field :max_workers, type: Integer, default: -> { Config.instance.max_workers } # When this server process was started field :started_at, type: Time # The heartbeat information for this server @@ -221,21 +221,21 @@ end # Management Thread def run logger.info "Using MongoDB Database: #{RocketJob::Job.collection.database.name}" - build_heartbeat(updated_at: Time.now, current_threads: 0) + build_heartbeat(updated_at: Time.now, workers: 0) started! adjust_workers(true) logger.info "RocketJob Server started with #{workers.size} workers running" while running? || paused? sleep Config.instance.heartbeat_seconds find_and_update( - 'heartbeat.updated_at' => Time.now, - 'heartbeat.current_threads' => worker_count + 'heartbeat.updated_at' => Time.now, + 'heartbeat.workers' => worker_count ) # In case number of threads has been modified adjust_workers @@ -253,11 +253,11 @@ workers.shift else # Timeout waiting for worker to stop begin find_and_update( - 'heartbeat.updated_at' => Time.now, - 'heartbeat.current_threads' => worker_count + 'heartbeat.updated_at' => Time.now, + 'heartbeat.workers' => worker_count ) rescue Mongoid::Errors::DocumentNotFound logger.warn('Server has been destroyed. Going down hard!') break end