passenger-oob-gc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/LICENSE +22 -0
- data/Rakefile +2 -0
- data/Readme.md +25 -0
- data/init.rb +3 -0
- data/lib/process-request.rb +26 -0
- data/passenger-oob-gc.gemspec +28 -0
- metadata +89 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Stefan Husch, qutic development
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/Readme.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Passenger OOB-GC
|
2
|
+
|
3
|
+
Run the Ruby Garbage Collection (GC) outside of the Passenger request cycle.
|
4
|
+
|
5
|
+
The original idea for this gem came from [Yuichi Tateno](http://rubyforge.org/pipermail/mongrel-unicorn/2011-October/001207.html) and [Eric Lindvall](http://stackoverflow.com/questions/6221942/is-there-an-easy-way-to-run-garbage-collection-outside-of-the-request-cycle-in-p).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install passenger_oob_gc
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Add the following code to an
|
16
|
+
|
17
|
+
```
|
18
|
+
if defined?(PhusionPassenger::Utils::UnseekableSocket)
|
19
|
+
PassengerOobGC.install!
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
Use it on your on risk.
|
24
|
+
|
25
|
+
Copyright (c) 2012 Stefan Husch, qutic development.
|
data/init.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module PassengerOobGC
|
2
|
+
def self.install!
|
3
|
+
PhusionPassenger::Utils::UnseekableSocket.send :include, self
|
4
|
+
GC.disable
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.send :alias_method_chain, :close, :gc
|
9
|
+
end
|
10
|
+
|
11
|
+
def close_with_gc
|
12
|
+
begin
|
13
|
+
@socket.close
|
14
|
+
rescue => e
|
15
|
+
raise annotate(e)
|
16
|
+
ensure
|
17
|
+
t = Benchmark.realtime do
|
18
|
+
enabled = GC.enable
|
19
|
+
GC.start
|
20
|
+
GC.disable if enabled
|
21
|
+
end
|
22
|
+
Rails.logger.debug("[PassengerOobGC] closing socket, GC: %.1fms" % [t*1000])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# to publish the gem to rubygems.org run:
|
4
|
+
# rake build
|
5
|
+
# gem push pkg/passenger-oob-gc-0.0.1.gem
|
6
|
+
#
|
7
|
+
# to install locally from gem run:
|
8
|
+
# gem install pkg/passenger-oob-gc-0.0.1.gem
|
9
|
+
#
|
10
|
+
Gem::Specification.new do |s|
|
11
|
+
s.name = "passenger-oob-gc"
|
12
|
+
s.version = "0.0.1"
|
13
|
+
s.platform = Gem::Platform::RUBY
|
14
|
+
s.authors = ["Stefan Husch"]
|
15
|
+
s.email = ["s.husch@qutic.com"]
|
16
|
+
s.homepage = "https://github.com/jfqd/passenger-oob-gc"
|
17
|
+
s.summary = %q{Run GC outside of the Passenger request cycle}
|
18
|
+
s.description = %q{Run the Ruby Garbage Collection (GC) outside of the Passenger request cycle.}
|
19
|
+
|
20
|
+
s.add_dependency('passenger', '>= 3.0.11')
|
21
|
+
|
22
|
+
s.rubyforge_project = "passenger-oob-gc"
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: passenger-oob-gc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Stefan Husch
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-12-17 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: passenger
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 17
|
30
|
+
segments:
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
- 11
|
34
|
+
version: 3.0.11
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Run the Ruby Garbage Collection (GC) outside of the Passenger request cycle.
|
38
|
+
email:
|
39
|
+
- s.husch@qutic.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- LICENSE
|
49
|
+
- Rakefile
|
50
|
+
- Readme.md
|
51
|
+
- init.rb
|
52
|
+
- lib/process-request.rb
|
53
|
+
- passenger-oob-gc.gemspec
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: https://github.com/jfqd/passenger-oob-gc
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project: passenger-oob-gc
|
84
|
+
rubygems_version: 1.4.2
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Run GC outside of the Passenger request cycle
|
88
|
+
test_files: []
|
89
|
+
|