daemonz 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source :rubygems
3
3
  gem 'posix-spawn', '>= 0.3.6'
4
4
  gem 'simple-daemon', '>= 0.1.2'
5
5
  gem 'rails', '>= 3.2.8'
6
+ gem 'sys-proctable', '>= 0.9.1'
6
7
  gem 'zerg_support', '>= 0.1.5'
7
8
 
8
9
  group :development do
@@ -86,6 +86,7 @@ GEM
86
86
  rack (~> 1.0)
87
87
  tilt (~> 1.1, != 1.3.0)
88
88
  sqlite3 (1.3.6)
89
+ sys-proctable (0.9.1)
89
90
  thor (0.16.0)
90
91
  tilt (1.3.3)
91
92
  treetop (1.4.10)
@@ -108,4 +109,5 @@ DEPENDENCIES
108
109
  simple-daemon (>= 0.1.2)
109
110
  simplecov
110
111
  sqlite3 (>= 1.3.6)
112
+ sys-proctable (>= 0.9.1)
111
113
  zerg_support (>= 0.1.5)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.8
1
+ 0.3.9
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "daemonz"
8
- s.version = "0.3.8"
8
+ s.version = "0.3.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Victor Costan"]
12
- s.date = "2012-09-14"
12
+ s.date = "2012-09-17"
13
13
  s.description = "Works with Facebook."
14
14
  s.email = "victor@costan.us"
15
15
  s.extra_rdoc_files = [
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.homepage = "http://github.com/costan/daemonz"
51
51
  s.licenses = ["MIT"]
52
52
  s.require_paths = ["lib"]
53
- s.rubygems_version = "1.8.24"
53
+ s.rubygems_version = "1.8.23"
54
54
  s.summary = "User authentication for Rails 3 applications."
55
55
 
56
56
  if s.respond_to? :specification_version then
@@ -60,6 +60,7 @@ Gem::Specification.new do |s|
60
60
  s.add_runtime_dependency(%q<posix-spawn>, [">= 0.3.6"])
61
61
  s.add_runtime_dependency(%q<simple-daemon>, [">= 0.1.2"])
62
62
  s.add_runtime_dependency(%q<rails>, [">= 3.2.8"])
63
+ s.add_runtime_dependency(%q<sys-proctable>, [">= 0.9.1"])
63
64
  s.add_runtime_dependency(%q<zerg_support>, [">= 0.1.5"])
64
65
  s.add_development_dependency(%q<bundler>, [">= 1.2.0"])
65
66
  s.add_development_dependency(%q<flexmock>, [">= 1.0.2"])
@@ -72,6 +73,7 @@ Gem::Specification.new do |s|
72
73
  s.add_dependency(%q<posix-spawn>, [">= 0.3.6"])
73
74
  s.add_dependency(%q<simple-daemon>, [">= 0.1.2"])
74
75
  s.add_dependency(%q<rails>, [">= 3.2.8"])
76
+ s.add_dependency(%q<sys-proctable>, [">= 0.9.1"])
75
77
  s.add_dependency(%q<zerg_support>, [">= 0.1.5"])
76
78
  s.add_dependency(%q<bundler>, [">= 1.2.0"])
77
79
  s.add_dependency(%q<flexmock>, [">= 1.0.2"])
@@ -85,6 +87,7 @@ Gem::Specification.new do |s|
85
87
  s.add_dependency(%q<posix-spawn>, [">= 0.3.6"])
86
88
  s.add_dependency(%q<simple-daemon>, [">= 0.1.2"])
87
89
  s.add_dependency(%q<rails>, [">= 3.2.8"])
90
+ s.add_dependency(%q<sys-proctable>, [">= 0.9.1"])
88
91
  s.add_dependency(%q<zerg_support>, [">= 0.1.5"])
89
92
  s.add_dependency(%q<bundler>, [">= 1.2.0"])
90
93
  s.add_dependency(%q<flexmock>, [">= 1.0.2"])
@@ -10,11 +10,16 @@
10
10
  :root_path: <%= Rails.root %>
11
11
 
12
12
  # Where daemonz should log - set to stdout, stderr, or rails.
13
- :logger: stdout
13
+ :logger: rails
14
14
 
15
- # Set to true to completely disable daemonz, and not load any plugins.
15
+ # Set to true to completely disable daemonz, and not load any daemon.
16
16
  :disabled: false
17
17
 
18
+ # Set to true to have the daemons started on a separate thread, so they don't
19
+ # block the server start-up process. Set to false if your application
20
+ # communicates with the daemons directly, e.g. via DRb.
21
+ :async_start: true
22
+
18
23
  # daemonz is loaded every time the Rails framework is loaded. Sometimes
19
24
  # (e.g. when performing migrations) daemons aren't required, so we shouldn't
20
25
  # have to wait for the few seconds it takes to start / stop daemons.
@@ -38,7 +38,22 @@ module Daemonz
38
38
  end
39
39
 
40
40
  def self.start_daemons!
41
- @daemons.each { |daemon| start_daemon! daemon }
41
+ if Daemonz.config[:async_start]
42
+ Thread.new { start_daemons_sync }
43
+ else
44
+ start_daemons_sync
45
+ end
46
+ end
47
+
48
+ def self.start_daemons_sync
49
+ begin
50
+ @daemons.each { |daemon| start_daemon! daemon }
51
+ rescue Exception => e
52
+ logger.warn "Daemonz startup process failed. #{e.class}: #{e}\n" +
53
+ e.backtrace.join("\n")
54
+ ensure
55
+ logger.flush
56
+ end
42
57
  end
43
58
 
44
59
  def self.stop_daemons!
@@ -46,6 +61,7 @@ module Daemonz
46
61
  end
47
62
 
48
63
  def self.start_daemon!(daemon)
64
+ logger.info "Daemonz killing any old instances of #{daemon[:name]}"
49
65
  # cleanup before we start
50
66
  kill_process_set daemon[:stop][:cmdline], daemon[:pids],
51
67
  daemon[:kill_patterns],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daemonz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-14 00:00:00.000000000 Z
12
+ date: 2012-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: posix-spawn
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.2.8
62
+ - !ruby/object:Gem::Dependency
63
+ name: sys-proctable
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.9.1
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.1
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: zerg_support
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -239,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
255
  version: '0'
240
256
  segments:
241
257
  - 0
242
- hash: 714603519504973257
258
+ hash: 688789652917048777
243
259
  required_rubygems_version: !ruby/object:Gem::Requirement
244
260
  none: false
245
261
  requirements:
@@ -248,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
264
  version: '0'
249
265
  requirements: []
250
266
  rubyforge_project:
251
- rubygems_version: 1.8.24
267
+ rubygems_version: 1.8.23
252
268
  signing_key:
253
269
  specification_version: 3
254
270
  summary: User authentication for Rails 3 applications.