spawnling 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -96,13 +96,16 @@ The options you can pass to spawn are:
96
96
  <tr><td>:kill</td><td>boolean value indicating whether the parent should kill the spawned process
97
97
  when it exits (only valid when :method => :fork)</td></tr>
98
98
  <tr><td>:argv</td><td>string to override the process name</td></tr>
99
+ <tr><td>:detach</td><td>boolean value indicating whether the parent should Process.detach the
100
+ spawned processes. (defaults to true). You *must* Spawnling.wait or Process.wait if you use this.
101
+ Changing this allows you to wait for the first child to exit instead of waiting for all of them.</td></tr>
99
102
  </table>
100
103
 
101
104
  Any option to spawn can be set as a default so that you don't have to pass them in
102
105
  to every call of spawn. To configure the spawn default options, add a line to
103
106
  your configuration file(s) like this:
104
107
  ```ruby
105
- Spawnling.default_options {:method => :thread}
108
+ Spawnling::default_options :method => :thread
106
109
  ```
107
110
  If you don't set any default options, the :method will default to :fork. To
108
111
  specify different values for different environments, add the default_options call to
@@ -110,9 +113,9 @@ he appropriate environment file (development.rb, test.rb). For testing you can
110
113
  the default :method to :yield so that the code is run inline.
111
114
  ```ruby
112
115
  # in environment.rb
113
- Spawnling.method :method => :fork, :nice => 7
116
+ Spawnling::default_options :method => :fork, :nice => 7
114
117
  # in test.rb, will override the environment.rb setting
115
- Spawnling.method :method => :yield
118
+ Spawnling::default_options :method => :yield
116
119
  ```
117
120
  This allows you to set your production and development environments to use different
118
121
  methods according to your needs.
@@ -134,8 +134,10 @@ if need_passenger_patch
134
134
  end
135
135
  end
136
136
 
137
- if defined?(Rails)
138
- if defined?(::ActiveSupport::Cache::MemCacheStore) && Rails.cache.class.name == 'ActiveSupport::Cache::MemCacheStore'
139
- ::ActiveSupport::Cache::MemCacheStore.delegate :reset, :to => :@data
137
+ class SpawnlingCache < Rails::Railtie
138
+ initializer "cache" do
139
+ if defined?(::ActiveSupport::Cache::MemCacheStore) && Rails.cache.class.name == 'ActiveSupport::Cache::MemCacheStore'
140
+ ::ActiveSupport::Cache::MemCacheStore.delegate :reset, :to => :@data
141
+ end
140
142
  end
141
143
  end
@@ -16,7 +16,8 @@ class Spawnling
16
16
  :method => ((RUBY_PLATFORM =~ /(win32|mingw32|java)/) ? :thread : :fork),
17
17
  :nice => nil,
18
18
  :kill => false,
19
- :argv => nil
19
+ :argv => nil,
20
+ :detach => true
20
21
  }
21
22
 
22
23
  # things to close in child process
@@ -46,6 +47,9 @@ class Spawnling
46
47
  # :kill => whether or not the parent process will kill the
47
48
  # spawned child process when the parent exits
48
49
  # :argv => changes name of the spawned process as seen in ps
50
+ # :detach => whether or not Process.detach is called for spawned child
51
+ # processes. You must wait for children on your own if you
52
+ # set this to false
49
53
  def self.default_options(options = {})
50
54
  @@default_options.merge!(options)
51
55
  @@logger.info "spawn> default options = #{options.inspect}" if @@logger
@@ -199,7 +203,7 @@ class Spawnling
199
203
  end
200
204
 
201
205
  # detach from child process (parent may still wait for detached process if they wish)
202
- Process.detach(child)
206
+ Process.detach(child) if options[:detach]
203
207
 
204
208
  # remove dead children from the target list to avoid memory leaks
205
209
  @@punks.delete_if {|punk| !Spawn.alive?(punk)}
@@ -1,3 +1,3 @@
1
1
  class Spawnling
2
- VERSION = '2.1.5'
2
+ VERSION = '2.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spawnling
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Tom Anderson
@@ -9,142 +10,164 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-07-06 00:00:00.000000000 Z
13
+ date: 2015-05-14 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: bundler
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - ">="
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :development
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - ">="
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: rake
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - ">="
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
39
  type: :development
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - ">="
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: rspec
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - "~>"
52
+ - - ~>
47
53
  - !ruby/object:Gem::Version
48
54
  version: '2.0'
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - "~>"
60
+ - - ~>
54
61
  - !ruby/object:Gem::Version
55
62
  version: '2.0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: simplecov
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - ">="
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '0'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - ">="
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: simplecov-rcov
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
- - - ">="
84
+ - - ! '>='
75
85
  - !ruby/object:Gem::Version
76
86
  version: '0'
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
- - - ">="
92
+ - - ! '>='
82
93
  - !ruby/object:Gem::Version
83
94
  version: '0'
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: coveralls
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
- - - ">="
100
+ - - ! '>='
89
101
  - !ruby/object:Gem::Version
90
102
  version: '0'
91
103
  type: :development
92
104
  prerelease: false
93
105
  version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
94
107
  requirements:
95
- - - ">="
108
+ - - ! '>='
96
109
  - !ruby/object:Gem::Version
97
110
  version: '0'
98
111
  - !ruby/object:Gem::Dependency
99
112
  name: rails
100
113
  requirement: !ruby/object:Gem::Requirement
114
+ none: false
101
115
  requirements:
102
- - - ">="
116
+ - - ! '>='
103
117
  - !ruby/object:Gem::Version
104
118
  version: '0'
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
108
123
  requirements:
109
- - - ">="
124
+ - - ! '>='
110
125
  - !ruby/object:Gem::Version
111
126
  version: '0'
112
127
  - !ruby/object:Gem::Dependency
113
128
  name: activerecord-nulldb-adapter
114
129
  requirement: !ruby/object:Gem::Requirement
130
+ none: false
115
131
  requirements:
116
- - - ">="
132
+ - - ! '>='
117
133
  - !ruby/object:Gem::Version
118
134
  version: '0'
119
135
  type: :development
120
136
  prerelease: false
121
137
  version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
122
139
  requirements:
123
- - - ">="
140
+ - - ! '>='
124
141
  - !ruby/object:Gem::Version
125
142
  version: '0'
126
143
  - !ruby/object:Gem::Dependency
127
144
  name: dalli
128
145
  requirement: !ruby/object:Gem::Requirement
146
+ none: false
129
147
  requirements:
130
- - - ">="
148
+ - - ! '>='
131
149
  - !ruby/object:Gem::Version
132
150
  version: '0'
133
151
  type: :development
134
152
  prerelease: false
135
153
  version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
136
155
  requirements:
137
- - - ">="
156
+ - - ! '>='
138
157
  - !ruby/object:Gem::Version
139
158
  version: '0'
140
- description: |-
141
- This plugin provides a 'Spawnling' class to easily fork OR
159
+ description: ! 'This plugin provides a ''Spawnling'' class to easily fork OR
160
+
142
161
  thread long-running sections of code so that your application can return
162
+
143
163
  results to your users more quickly. This plugin works by creating new database
164
+
144
165
  connections in ActiveRecord::Base for the spawned block.
145
166
 
167
+
146
168
  The plugin also patches ActiveRecord::Base to handle some known bugs when using
147
- threads (see lib/patches.rb).
169
+
170
+ threads (see lib/patches.rb).'
148
171
  email:
149
172
  - tom@squeat.com
150
173
  - michael+spawnling@noack.com.au
@@ -152,9 +175,9 @@ executables: []
152
175
  extensions: []
153
176
  extra_rdoc_files: []
154
177
  files:
155
- - ".gitignore"
156
- - ".rspec"
157
- - ".travis.yml"
178
+ - .gitignore
179
+ - .rspec
180
+ - .travis.yml
158
181
  - CHANGELOG
159
182
  - Gemfile
160
183
  - LICENSE
@@ -176,26 +199,33 @@ files:
176
199
  homepage: http://github.com/tra/spawnling
177
200
  licenses:
178
201
  - MIT
179
- metadata: {}
180
202
  post_install_message:
181
203
  rdoc_options: []
182
204
  require_paths:
183
205
  - lib
184
206
  required_ruby_version: !ruby/object:Gem::Requirement
207
+ none: false
185
208
  requirements:
186
- - - ">="
209
+ - - ! '>='
187
210
  - !ruby/object:Gem::Version
188
211
  version: '0'
212
+ segments:
213
+ - 0
214
+ hash: 1575267209978026361
189
215
  required_rubygems_version: !ruby/object:Gem::Requirement
216
+ none: false
190
217
  requirements:
191
- - - ">="
218
+ - - ! '>='
192
219
  - !ruby/object:Gem::Version
193
220
  version: '0'
221
+ segments:
222
+ - 0
223
+ hash: 1575267209978026361
194
224
  requirements: []
195
225
  rubyforge_project:
196
- rubygems_version: 2.2.1
226
+ rubygems_version: 1.8.23
197
227
  signing_key:
198
- specification_version: 4
228
+ specification_version: 3
199
229
  summary: Easily fork OR thread long-running sections of code in Ruby
200
230
  test_files:
201
231
  - spec/spawn/spawn_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 46683af41ff0f9b4d4078d02a1009371670f1c0e
4
- data.tar.gz: 114aa427aabb0bfc096967528b53fb1ca6a2aed8
5
- SHA512:
6
- metadata.gz: fefb1f49fa3a27b0b3fd8d5d645738fe27623881e01e804946e4c9645231443067fea45df43e26be5f5f92b4626165dbf81f22e510f3809a1b22b9946a72745a
7
- data.tar.gz: 8601bbf865be9fac8277b402d25418e4125305d0bd01b573f86a0a67bbabd2f429f9bb08bd2e8c49eb6fbd714c00339a209e84ba76a911717398050d0b1e9f4a