foreverb 0.3.0.l → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +5 -2
- data/README.md +2 -1
- data/lib/forever.rb +0 -2
- data/lib/forever/base.rb +7 -11
- data/lib/forever/version.rb +1 -1
- metadata +7 -10
data/CHANGES.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
# Version 0.3.0 -
|
1
|
+
# Version 0.3.0 - January 25, 2012
|
2
2
|
|
3
3
|
* Added fork backend
|
4
4
|
* Improved queue
|
5
5
|
* Added before/after each/all filters
|
6
6
|
* Added remove config method from our cli
|
7
7
|
* Improved documentation
|
8
|
+
* Remove zombies processes
|
9
|
+
* Back to yaml psyck
|
10
|
+
* Fix yaml config writer/reader
|
8
11
|
|
9
12
|
# Version 0.2.6 - August 27, 2011
|
10
13
|
|
@@ -32,4 +35,4 @@
|
|
32
35
|
* Added `restart` CLI command
|
33
36
|
* Added `tail` CLI command
|
34
37
|
* Added `update` CLI command (useful to update daemons config)
|
35
|
-
* Improved documentation
|
38
|
+
* Improved documentation
|
data/README.md
CHANGED
@@ -174,7 +174,7 @@ $ examples/sample; tail -f -n 150 examples/log/sample.log; examples/sample stop
|
|
174
174
|
you should see:
|
175
175
|
|
176
176
|
```
|
177
|
-
=> Pid not found, process seems
|
177
|
+
=> Pid not found, process seems doesn't exist!
|
178
178
|
=> Process demonized with pid 11509 with Forever v.0.2.0
|
179
179
|
[14/07 15:46:56] All jobs will will wait me for 1 second
|
180
180
|
[14/07 15:46:57] Every 10 second
|
@@ -370,6 +370,7 @@ This is similar to create a new process i.e.:
|
|
370
370
|
Process.fork do
|
371
371
|
require '/config/boot'
|
372
372
|
my_long_jobs
|
373
|
+
Project.all(&:perform_long_task)
|
373
374
|
end
|
374
375
|
Process.waitall
|
375
376
|
```
|
data/lib/forever.rb
CHANGED
@@ -4,8 +4,6 @@ require 'forever/job'
|
|
4
4
|
require 'forever/base'
|
5
5
|
require 'forever/version'
|
6
6
|
|
7
|
-
YAML::ENGINE.yamler = 'syck' if defined?(YAML::ENGINE)
|
8
|
-
|
9
7
|
FOREVER_PATH = ENV['FOREVER_PATH'] ||= File.expand_path("~/.foreverb") unless defined?(FOREVER_PATH)
|
10
8
|
path = File.dirname(FOREVER_PATH)
|
11
9
|
Dir.mkdir(path) unless File.exist?(path)
|
data/lib/forever/base.rb
CHANGED
@@ -63,6 +63,8 @@ module Forever
|
|
63
63
|
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
|
64
64
|
|
65
65
|
fork do
|
66
|
+
Process.setsid
|
67
|
+
|
66
68
|
$0 = "Forever: #{$0}"
|
67
69
|
print "[\e[90m%s\e[0m] Process demonized with pid \e[1m%d\e[0m with \e[1m%s\e[0m and Forever v.%s\n" %
|
68
70
|
[name, Process.pid, forking ? :fork : :thread, Forever::VERSION]
|
@@ -102,7 +104,7 @@ module Forever
|
|
102
104
|
if forking
|
103
105
|
begin
|
104
106
|
GC.start
|
105
|
-
pids << fork { job_call(job)
|
107
|
+
pids << fork { job_call(job) }
|
106
108
|
rescue Errno::EAGAIN
|
107
109
|
puts "\n\nWait all processes since os cannot create a new one\n\n"
|
108
110
|
Process.waitall
|
@@ -113,18 +115,12 @@ module Forever
|
|
113
115
|
current_queue += 1
|
114
116
|
end
|
115
117
|
|
118
|
+
# Detach zombies, our ps will be happier
|
119
|
+
pids.delete_if { |p| Process.detach(p).stop? }
|
120
|
+
|
116
121
|
sleep 0.5
|
117
122
|
end
|
118
123
|
|
119
|
-
# Detach zombies, our ps will be happier
|
120
|
-
pids.each do |p|
|
121
|
-
begin
|
122
|
-
pids << Process.getpgid(p)
|
123
|
-
rescue Errno::ESRCH
|
124
|
-
pids.delete(p)
|
125
|
-
Process.detach(p)
|
126
|
-
end
|
127
|
-
end
|
128
124
|
|
129
125
|
# Invoke our after :all filters
|
130
126
|
filters[:after][:all].each { |block| safe_call(block) }
|
@@ -288,7 +284,7 @@ module Forever
|
|
288
284
|
current = File.read(pid).to_i
|
289
285
|
print "[\e[90m%s\e[0m] Found pid \e[1m%d\e[0m...\n" % [name, current] unless silent
|
290
286
|
else
|
291
|
-
print "[\e[90m%s\e[0m] Pid \e[1mnot found\e[0m, process seems
|
287
|
+
print "[\e[90m%s\e[0m] Pid \e[1mnot found\e[0m, process seems doesn't exist!\n" % name unless silent
|
292
288
|
return false
|
293
289
|
end
|
294
290
|
|
data/lib/forever/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreverb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
9
|
- 0
|
10
|
-
|
11
|
-
version: 0.3.0.l
|
10
|
+
version: 0.3.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- DAddYE
|
@@ -96,14 +95,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
96
|
none: false
|
98
97
|
requirements:
|
99
|
-
- - "
|
98
|
+
- - ">="
|
100
99
|
- !ruby/object:Gem::Version
|
101
|
-
hash:
|
100
|
+
hash: 3
|
102
101
|
segments:
|
103
|
-
-
|
104
|
-
|
105
|
-
- 1
|
106
|
-
version: 1.3.1
|
102
|
+
- 0
|
103
|
+
version: "0"
|
107
104
|
requirements: []
|
108
105
|
|
109
106
|
rubyforge_project: foreverb
|