GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Push jobs into starling
Clone URL: git://github.com/fesplugas/simplified_starling.git
If pid file for starling exists, it could be dead -- check to see if it is 
actually running (joevandyk)
fesplugas (author)
Mon Aug 25 06:38:22 -0700 2008
commit  016a29cd5e97704d55561d5bf34255880dfc0cf4
tree    1806d9a6c573c1b972be95625fcc8bc32dacf253
parent  d7952b04d2c182f6c7f86f128f8989699dc686ff
...
8
9
10
 
 
 
 
 
 
 
 
 
11
12
13
...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0
@@ -8,6 +8,15 @@ module Simplified
0
 
0
   class Starling
0
 
0
+ def self.running?
0
+ config = YAML.load_file("#{RAILS_ROOT}/config/starling.yml")[RAILS_ENV]
0
+ if File.exist?(config['pid_file'])
0
+ Process.getpgid(File.read(config['pid_file']).to_i) rescue return false
0
+ else
0
+ return false
0
+ end
0
+ end
0
+
0
     def self.prepare(queue)
0
       self.feedback("Queue processor started for `#{queue}`.")
0
       start_processing(queue)
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@ namespace :simplified_starling do
0
   desc "Start starling server"
0
   task :start do
0
     config = YAML.load_file("#{RAILS_ROOT}/config/starling.yml")[RAILS_ENV]
0
- unless File.exist?(config['pid_file'])
0
+ unless Simplified::Starling.running?
0
       starling_binary = `which starling`.strip
0
       raise RuntimeError, "Cannot find starling" if starling_binary.blank?
0
       options = []

Comments

    No one has commented yet.