h2ocube_rails_rainbows 0.0.4 → 0.0.5

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: 6646e41efdc1b6d741da98dc932c4824dd6cc4dc
4
- data.tar.gz: 9b128a24cd79b35706b8f279b1edcb1ad49a4109
3
+ metadata.gz: aa4cae7dfaf54eb6d88462be6ee311da398999d1
4
+ data.tar.gz: b9e5fe6433c2bcd83157c1803399a0d6f7802bb8
5
5
  SHA512:
6
- metadata.gz: 1609e592fe7fd141b36c5112f293466bccc2a1be9a55abe2ddc64e6c3204f0fe96bb44bd717f65222332cbec5f9438e17cae90bb32f805f7b6d59e106c1de723
7
- data.tar.gz: 986770036a2f648b288a2fd11b0ec03e0fd38faf08bc44fd6c20ea8191fac8682f134d22a821e9a755eccd5075dcd61d90eb7eb376275df1350eda4597213b02
6
+ metadata.gz: b64c45b2cfc2d1fa8f20c6e72b54c5ac427574276786d2f86988089f346321817de88ac815a892859cae7b5f523f8f3c37308f79f84f000f13db1d0970ffec96
7
+ data.tar.gz: 75fbb7ec44b76b3f370465af15dc3a329431fa7657407568aa4fcaa331d4cc1e5810ed816b02b6ae2888b201b80abd8903d010087255f2cadbe4fab25de83899
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'h2ocube_rails_rainbows'
7
- spec.version = '0.0.4'
7
+ spec.version = '0.0.5'
8
8
  spec.authors = ['Ben']
9
9
  spec.email = ['ben@zfben.com']
10
10
  spec.description = %q{Rainbows! helper}
@@ -11,8 +11,21 @@ namespace :rainbows do
11
11
  desc 'Stop rainbows'
12
12
  task :stop do
13
13
  on roles :app do
14
- within release_path do
15
- execute "kill -s QUIT `cat #{shared_path}/pids/rainbows.pid`;true"
14
+ pid_exist = 'true' == capture("if [ -e #{shared_path}/pids/rainbows.pid ]; then echo 'true'; fi").strip
15
+ times = 0
16
+ until pid_exist && times < 10 do
17
+ within release_path do
18
+ execute "kill -s QUIT `cat #{shared_path}/pids/rainbows.pid`;true"
19
+ end
20
+ sleep 1
21
+ pid_exist = 'true' == capture("if [ -e #{shared_path}/pids/rainbows.pid ]; then echo 'true'; fi").strip
22
+ times = times + 1
23
+ end
24
+
25
+ if times > 9
26
+ within shared_path do
27
+ execute :rm, 'pids/rainbows.pid;true'
28
+ end
16
29
  end
17
30
  end
18
31
  end
@@ -34,7 +47,6 @@ namespace :rainbows do
34
47
  desc 'Cold Restart rainbows'
35
48
  task :cold_restart do
36
49
  invoke 'rainbows:stop'
37
- sleep 3
38
50
  invoke 'rainbows:start'
39
51
  end
40
52
 
@@ -11,6 +11,14 @@ stdout_path 'log/rainbows.stdout.log'
11
11
 
12
12
  before_fork do |server, worker|
13
13
  ActiveRecord::Base.connection.disconnect! if defined?(ActiveRecord)
14
+ old_pid = "#{server.config[:pid]}.oldbin"
15
+ if File.exists?(old_pid) && server.pid != old_pid
16
+ begin
17
+ Process.kill("QUIT", File.read(old_pid).to_i)
18
+ rescue Errno::ENOENT, Errno::ESRCH
19
+ # someone else did our job for us
20
+ end
21
+ end
14
22
  end
15
23
 
16
24
  after_fork do |server, worker|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h2ocube_rails_rainbows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbows