sensu-spawn 1.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sensu/spawn.rb +15 -3
- data/sensu-spawn.gemspec +1 -1
- data/spec/spawn_spec.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a5ddfaf5cb5f4c364d433a3ba8916b571060d8
|
4
|
+
data.tar.gz: e9a0cfb1692724f8e67969160812dc6218f986fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b71c329d9cb7a936a326775ff298269bf725c112e49db42900846475516e3d4bdc437da87501130636aedbf9d527040d60a457b023e697eacedb322ef7c7ad0
|
7
|
+
data.tar.gz: e49eace6222275956d35456253b7f1ed4e9c06545a1ce2cb8ea48541c9b71ebfbe421b3cd81632edc1037c72057d4e39c932ed7672b0386bee2634b7ac99b12f
|
data/lib/sensu/spawn.rb
CHANGED
@@ -23,8 +23,20 @@ module Sensu
|
|
23
23
|
@@mutex = Mutex.new
|
24
24
|
|
25
25
|
class << self
|
26
|
-
#
|
27
|
-
#
|
26
|
+
# Setup a spawn process worker, to limit the number of
|
27
|
+
# concurrent child processes allowed at one time. This method
|
28
|
+
# creates the spawn process worker instance variable:
|
29
|
+
# `@process_worker`.
|
30
|
+
#
|
31
|
+
# @param [Hash] options to create a process worker with.
|
32
|
+
# @option options [Integer] :limit max number of child processes
|
33
|
+
# at a time.
|
34
|
+
def setup(options={})
|
35
|
+
limit = options[:limit] || 12
|
36
|
+
@process_worker ||= EM::Worker.new(:concurrency => limit)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Spawn a child process. The EventMachine reactor (loop) must be
|
28
40
|
# running for this method to work.
|
29
41
|
#
|
30
42
|
# @param [String] command to run.
|
@@ -37,7 +49,7 @@ module Sensu
|
|
37
49
|
create = Proc.new do
|
38
50
|
child_process(command, options)
|
39
51
|
end
|
40
|
-
|
52
|
+
setup(options) unless @process_worker
|
41
53
|
@process_worker.enqueue(create, callback)
|
42
54
|
end
|
43
55
|
|
data/sensu-spawn.gemspec
CHANGED
data/spec/spawn_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-spawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.6.3
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: The Sensu spawn process library
|