capistrano-resque-pool 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/capistrano/resque/pool/version.rb +1 -1
- data/lib/capistrano/tasks/capistrano-resque-pool.rake +35 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 706da99c97ea705d8c6454c551c18f78212eabed
|
|
4
|
+
data.tar.gz: 88b38e72e580dbe67f7fb9247c64251f926e17c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a1b4780bfd1e5afd6a5e030b4d373ee8566d64ee1737516cab9a5952bc9bcf29d74033dda2b21b26ed9acde19ff849b163f20bf6b513c3b6908b95fd38a3ded8
|
|
7
|
+
data.tar.gz: 2255a187f57b24ae1047f424fc3372a702095371245dbda09ed87123868b56150f8943251191203c3acc454bd78ad53060d0076225589f9ae1b7599e4be785e0
|
data/README.md
CHANGED
|
@@ -34,6 +34,10 @@ Reload the config file, reload logfiles, restart all workers.
|
|
|
34
34
|
|
|
35
35
|
bundle exec cap production resque:pool:restart
|
|
36
36
|
|
|
37
|
+
Gracefully shut down workers, Gracefully shut down manager, start a new manager and it's workers
|
|
38
|
+
|
|
39
|
+
bundle exec cap production resque:pool:full_restart
|
|
40
|
+
|
|
37
41
|
|
|
38
42
|
## Contributing
|
|
39
43
|
|
|
@@ -6,6 +6,7 @@ namespace :resque do
|
|
|
6
6
|
fetch(:stage) # so we need to fall back to the stage.
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
desc 'Start all the workers and queus'
|
|
10
11
|
task :start do
|
|
11
12
|
on roles(workers) do
|
|
@@ -18,7 +19,15 @@ namespace :resque do
|
|
|
18
19
|
desc 'Gracefully shut down workers and shutdown the manager after all workers are done'
|
|
19
20
|
task :stop do
|
|
20
21
|
on roles(workers) do
|
|
21
|
-
|
|
22
|
+
if pid_file_exists?
|
|
23
|
+
pid = capture(:cat, pid_path)
|
|
24
|
+
if test "kill -0 #{pid} > /dev/null 2>&1"
|
|
25
|
+
execute :kill, "-s QUIT #{pid}"
|
|
26
|
+
else
|
|
27
|
+
info "Process #{pid} from #{pid_path} is not running, cleaning up stale PID file"
|
|
28
|
+
execute :rm, pid_path
|
|
29
|
+
end
|
|
30
|
+
end
|
|
22
31
|
end
|
|
23
32
|
end
|
|
24
33
|
|
|
@@ -29,10 +38,30 @@ namespace :resque do
|
|
|
29
38
|
end
|
|
30
39
|
end
|
|
31
40
|
|
|
41
|
+
desc 'Stop the workers and the manager, re-start them (with a different pid)'
|
|
42
|
+
task :full_restart do
|
|
43
|
+
invoke 'resque:pool:stop'
|
|
44
|
+
|
|
45
|
+
# Wait for the manager to stop
|
|
46
|
+
on roles(workers) do
|
|
47
|
+
info "Waiting for pool manager to stop.. "
|
|
48
|
+
if pid_file_exists?
|
|
49
|
+
pid = capture(:cat, pid_path)
|
|
50
|
+
tries = 10
|
|
51
|
+
while tries >= 0 and test("kill -0 #{pid} > /dev/null 2>&1")
|
|
52
|
+
tries =- 1
|
|
53
|
+
sleep 5
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
invoke 'resque:pool:start'
|
|
59
|
+
end
|
|
60
|
+
|
|
32
61
|
desc 'Reload the config file, reload logfiles, restart all workers'
|
|
33
62
|
task :restart do
|
|
34
63
|
on roles(workers) do
|
|
35
|
-
if
|
|
64
|
+
if pid_file_exists?
|
|
36
65
|
execute :kill, "-s HUP `cat #{pid_path}`"
|
|
37
66
|
else
|
|
38
67
|
invoke 'resque:pool:start'
|
|
@@ -48,6 +77,10 @@ namespace :resque do
|
|
|
48
77
|
File.join(app_path, '/tmp/pids/resque-pool.pid')
|
|
49
78
|
end
|
|
50
79
|
|
|
80
|
+
def pid_file_exists?
|
|
81
|
+
return test("[ -f #{pid_path} ]")
|
|
82
|
+
end
|
|
83
|
+
|
|
51
84
|
def workers
|
|
52
85
|
fetch(:resque_server_roles) || :app
|
|
53
86
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-resque-pool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maxim Abramchuk
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2016-
|
|
12
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|