Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a monkey patch to daemons to add a random number to the pid fil…

…e filename so that the dieing daemons don't delete the pid files of the spawning daemons.
  • Loading branch information...
commit 94b477ea1920c06650de4b7e6e4f4669b8d3f8b0 1 parent c27fcff
Bracken Mosbacker bracken authored
Showing with 10 additions and 0 deletions.
  1. +1 −0  lib/delayed/command.rb
  2. +9 −0 lib/delayed/ext/daemons_monkey.rb
1  lib/delayed/command.rb
View
@@ -1,5 +1,6 @@
require 'rubygems'
require 'daemons'
+require File.expand_path(File.join(File.dirname(__FILE__), 'ext', 'daemons_monkey'))
require 'optparse'
module Delayed
9 lib/delayed/ext/daemons_monkey.rb
View
@@ -0,0 +1,9 @@
+module Daemons
+ class PidFile
+ def filename
+ @random_index ||= rand(100_000)
+ # the random number makes it so that the .pid files don't overlap in name.
+ File.join(@dir, "#{@progname}_#{@random_index}_#{ @number or '' }.pid")
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.