sponges 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f551ee294a287cee6d1203194614d8b248502a6e
4
- data.tar.gz: e83629c13573a38f4629fe65d6b48fe050d7c661
3
+ metadata.gz: d0148b0f41512aee87d7637ffde219add1b57041
4
+ data.tar.gz: 9f4c5659fe1817aecf1fb054118c829ad672e51c
5
5
  SHA512:
6
- metadata.gz: 2e3f1989505d429e94d865711cfc1182bf5bf480f182b599d941cd9419d4875840134d0529e353dadf00d26bf0be54cf1278f0b98987c6416b2ea645ea521fe7
7
- data.tar.gz: ceda65d4e04987e49e1640d8a7750a9e335778dc5824c38920fcfc6e9cdd0ab8a2d1bd0d28cc68c3e45e4fac81d31716b39d79941491f2aeeb090865ad274377
6
+ metadata.gz: 8fa957168031528c0ae92a12145a1df9bae034c047a9eb49aa496e32a6dccba41bdcb46a934359427d4d8813acb18905bdf33d6b46841033c5decde1f76e243f
7
+ data.tar.gz: 42b9af23f6e4317d1290718178572baa2be8c24f150641ad6689a040052d2142bf11e385e2ee5c7f495bfff701743bd82d3f7ca50a63e2444ba5fe888d316494
data/README.md CHANGED
@@ -4,13 +4,15 @@
4
4
  Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/AF83/sponges)
5
5
  [![Gem
6
6
  Version](https://fury-badge.herokuapp.com/rb/sponges.png)](http://badge.fury.io/rb/sponges)
7
+ [![Build
8
+ Status](https://travis-ci.org/AF83/sponges.png?branch=master)](https://travis-ci.org/AF83/sponges)
7
9
 
8
- When I build workers, I want them to be much like an army of spongebobs: always
9
- stressed and eager to work. `sponges` helps you with building this army of sponges,
10
- controling them, and, well, eventually killing them gracefully. Hum, making them
11
- stressed and eager to work would still be your job :)
10
+ When I build workers, I want them to be much like an army of Sponge Bobs: always
11
+ stressed, and eager to work. `sponges` helps you with building this army of sponges,
12
+ controlling them, and well, eventually killing them gracefully. Hum, making them
13
+ stressed and eager to work would still be your job. :)
12
14
 
13
- Basically, sponges is a ruby supervisor that forks processes and controls their
15
+ Basically, Sponges is a ruby supervisor that forks processes and controls their
14
16
  execution and termination. For example, the following will start a supervision
15
17
  daemon and 8 processes of "a_worker":
16
18
 
@@ -35,7 +37,7 @@ You may use bundler. In this case, add it to your `Gemfile`:
35
37
  gem "sponges"
36
38
  ```
37
39
 
38
- and run `bundle install`.
40
+ Then, run `bundle install`.
39
41
 
40
42
  ## Usage
41
43
 
@@ -110,7 +112,7 @@ Start 8 instances of the worker and daemonize them:
110
112
  ruby example.rb start -d -s 8 # By default, size equals cpu core's size.
111
113
  ```
112
114
 
113
- Retart gracefully 4 instances of the worker, with a timeout of 3 seconds and
115
+ Restart gracefully 4 instances of the worker, with a timeout of 3 seconds, and
114
116
  daemonize them:
115
117
  ``` bash
116
118
  ruby example.rb restart -g -s 4 -t 3
@@ -133,7 +135,7 @@ ruby example.rb stop -g -t 5
133
135
 
134
136
  In this case, you will have to trap the `HUP` signal, and handle a clean stop
135
137
  from each workers. The point is to wait for a task to be done before quitting. A
136
- timeout can be specify with the `-t` option. When this timeout is hit, the
138
+ timeout can be specified with the `-t` option. When this timeout is hit, the
137
139
  process is killed.
138
140
 
139
141
  Increment worker's pool size :
@@ -148,7 +150,7 @@ ruby example.rb decrement # will remove a worker from the pool.
148
150
 
149
151
  ## HTTP supervision
150
152
 
151
- sponges provides an HTTP interface to supervise the pool's activity, and to expose
153
+ Sponges provides an HTTP interface to supervise the pool's activity, and expose
152
154
  pids. HTTP supervision can be enabled in the configuration:
153
155
 
154
156
 
@@ -158,8 +160,8 @@ Sponges.configure do |config|
158
160
  end
159
161
  ```
160
162
 
161
- By default, sponges listens on port 5032, and responds in json. Here is an
162
- example of response:
163
+ By default, Sponges listens on port 5032, and responds with JSON. Here is a
164
+ sample:
163
165
 
164
166
  ``` javascript
165
167
  {
@@ -202,7 +204,7 @@ example of response:
202
204
 
203
205
  ## Acknowledgements
204
206
 
205
- sponges would not have been the same without [Jesse
207
+ Sponges would not have been the same without [Jesse
206
208
  Storimer](https://github.com/jstorimer) and his awesome book about
207
209
  [Unix](http://workingwithunixprocesses.com/).
208
210
 
@@ -9,6 +9,8 @@ module Sponges
9
9
  #
10
10
  def alive?(pid)
11
11
  !Sys::ProcTable.ps.find {|f| f.pid == pid }.nil?
12
+ rescue SystemCallError
13
+ false
12
14
  end
13
15
  private :alive?
14
16
  end
@@ -22,9 +22,11 @@ module Sponges
22
22
  response = Response.new(supervisor).to_json
23
23
  connection.write headers(response)
24
24
  connection.write response
25
- connection.close
26
- rescue Errno::EPIPE
27
- # Resist to ping
25
+ connection.close_write
26
+ connection.close_read
27
+ rescue SystemCallError
28
+ # Resist to system errors when closing or writing to a socket that is not
29
+ # opened.
28
30
  end
29
31
 
30
32
  def headers(response)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sponges
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sponges
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - chatgris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-27 00:00:00.000000000 Z
11
+ date: 2014-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: boson
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: machine
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.10.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.10.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: When I build workers, I want them to be like an army of spongebobs, always
56
70
  stressed and eager to work. sponges helps you build this army of sponges, to control
57
71
  them, and, well, to kill them gracefully. Making them stressed and eager to work
@@ -87,18 +101,19 @@ require_paths:
87
101
  - lib
88
102
  required_ruby_version: !ruby/object:Gem::Requirement
89
103
  requirements:
90
- - - '>='
104
+ - - ">="
91
105
  - !ruby/object:Gem::Version
92
106
  version: '0'
93
107
  required_rubygems_version: !ruby/object:Gem::Requirement
94
108
  requirements:
95
- - - '>='
109
+ - - ">="
96
110
  - !ruby/object:Gem::Version
97
111
  version: '0'
98
112
  requirements: []
99
113
  rubyforge_project:
100
- rubygems_version: 2.0.0.rc.2
114
+ rubygems_version: 2.2.2
101
115
  signing_key:
102
116
  specification_version: 4
103
117
  summary: Turn any ruby object to a daemon controlling an army of sponges.
104
118
  test_files: []
119
+ has_rdoc: