Navigation Menu

Skip to content

Commit

Permalink
Fix a problem that duplicated socket path for job queue on restart
Browse files Browse the repository at this point in the history
Here is a problem case:

  * Start f-p-d:
    * Create a new JobQueue.
    * The JobQueue creates #{DB_PATH}.sock.
    * Create workers.
    * Workers connect to #{DB_PATH}.sock.
  * `touch catalog.json`.
  * Start new dispatcher.
    * Create a new JobQueue.
    * The JobQueue removes existing #{DB_PATH}.sock and
      creates #{DB_PATH}.sock.
    * Create workers... (async. continue...)
  * Stop old dispatcher.
    * Stop its JobQueue.
    * The JobQueue removes #{DB_PATH}.sock.
  * Created workers. (cont.)
    * Workers connect to #{DB_PATH}.sock but #{DB_PATH}.sock doesn't exist!
  • Loading branch information
kou committed Apr 11, 2014
1 parent 87d350f commit 8ee807a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/droonga/job_pusher.rb
Expand Up @@ -25,7 +25,7 @@ class JobPusher
attr_reader :socket_path
def initialize(loop, base_path)
@loop = loop
@socket_path = "#{base_path}.sock"
@socket_path = "#{base_path}.#{Process.pid}.#{object_id}.sock"
@job_queue = JobQueue.new(@loop)
end

Expand Down

0 comments on commit 8ee807a

Please sign in to comment.