lib/rocket_job/worker.rb in rocketjob-2.0.0.rc1 vs lib/rocket_job/worker.rb in rocketjob-2.0.0.rc2
- old
+ new
@@ -1,7 +1,6 @@
# encoding: UTF-8
-require 'socket'
require 'concurrent'
module RocketJob
# Worker
#
# On startup a worker instance will automatically register itself
@@ -31,14 +30,13 @@
include Plugins::StateMachine
include SemanticLogger::Loggable
# @formatter:off
# Unique Name of this worker instance
- # Defaults to the `hostname` but _must_ be overriden if mutiple Worker instances
- # are started on the same host
+ # Default: `host name:PID`
# The unique name is used on re-start to re-queue any jobs that were being processed
# at the time the worker or host unexpectedly terminated, if any
- key :name, String, default: -> { "#{Socket.gethostname}:#{$$}" }
+ key :name, String, default: -> { "#{SemanticLogger.host}:#{$$}" }
# The maximum number of threads that this worker should use
# If set, it will override the default value in RocketJob::Config
key :max_threads, Integer, default: -> { Config.instance.max_worker_threads }