capistrano3-delayed-job 1.7.3 → 1.7.4

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: 8695030201916e5d7ee2fc013b575eb49d6b6fbc
4
- data.tar.gz: 579d7a880bfb07b87b5391ffd4be995bf2e2506c
3
+ metadata.gz: e4de514ccab20aa23140b8cac3c61332bb68dce1
4
+ data.tar.gz: 4a13b80787dc7fa7810dab0ae157ce2400fe3fe2
5
5
  SHA512:
6
- metadata.gz: cf85dce5eaa6b9aac31e7e24a53e809a0a3cd1faa781c16f33173fa6cc9719b536d4c1fd373210d624d67090dad5cc11167f356c0466746f9f71327825086db6
7
- data.tar.gz: a2da0ccad039e29fbd8baada6cb1542a27123bdbb2e403bf1bc0b3e505a126d76e6283125bd77b364f17c77fc71af2b9116a7f0328dd90bf1e0181c9a841c3c4
6
+ metadata.gz: d7510caa20a3d7279bff7baf4c910d5237dc1f08eb98ada5df66e48e59121e417cfbd3b2b441d84f0c59133b2c45fa70211e775dacad5b50275d5e7bcf54fd55
7
+ data.tar.gz: ebdd7821c73264e3407160d7e1f4c229c522755c62b17f4c74100290576d480fd04cd5b354d6889387bb86bebb8a252c9dac2846a16105ebda6fe9fecfd67c8d
data/README.md CHANGED
@@ -79,6 +79,27 @@ set :delayed_job_queues, ['mailer','tracking']
79
79
  # 'high_priority,*,low_priority' => 1, # works on whatever is available
80
80
  # '*,low_priority' => 1, # high_priority doesn't starve the little guys
81
81
  # }
82
+
83
+ # If you have several servers handling Delayed Jobs and you want to configure
84
+ # different pools per server, you can define delayed_job_pools_per_server:
85
+ #
86
+ # set :delayed_job_pools_per_server, {
87
+ # 'server11-prod' => {
88
+ # 'default,emails' => 3,
89
+ # 'loud_notifications' => 1,
90
+ # 'silent_notifications' => 1,
91
+ # },
92
+ # 'server12-prod' => {
93
+ # 'default' => 2
94
+ # }
95
+ # }
96
+
97
+ # Server names (server11-prod, server12-prod) in :delayed_job_pools_per_server
98
+ # must match the hostnames on Delayed Job servers. You can verify it by running
99
+ # `hostname` on your servers.
100
+
101
+ # If you use :delayed_job_pools_per_server, :delayed_job_pools will be ignored.
102
+
82
103
  # Identification is assigned in order 0..3.
83
104
  # Note that the '*' in this case is actually a queue with that name and does
84
105
  # not mean any queue as it is not used alone, but alongside other queues.
@@ -109,11 +130,19 @@ It also conditionally adds the following hook:
109
130
 
110
131
  ```ruby
111
132
  if Rake::Task.task_defined?('deploy:published')
112
- after 'deploy:published', 'delayed_job:restart'
133
+ after 'deploy:published', 'delayed_job:default'
134
+ end
135
+ ```
136
+
137
+ Where the `delayed_job:default` is defined as:
138
+
139
+ ```ruby
140
+ task :default do
141
+ invoke 'delayed_job:restart' if fetch(:delayed_job_default_hooks, true)
113
142
  end
114
143
  ```
115
144
 
116
- You can disable default hook by setting `delayed_job_default_hooks` to `false`. (It still gets _defined_, but will not do anything when called.)
145
+ Thus you can disable default hook by setting `delayed_job_default_hooks` to `false`. (It still gets _defined_, but will not do anything when called.)
117
146
 
118
147
  ```ruby
119
148
  set :delayed_job_default_hooks, false
@@ -145,8 +174,7 @@ Thank you [contributors](https://github.com/AgileConsultingLLC/capistrano3-delay
145
174
  capistrano3-delayed-job is maintained [Rob Biedenharn](https://github.com/rab) and
146
175
  [![Logo of Agile Consulting LLC](http://agileconsultingllc.com/agile-logo-small.png "Agile Consulting LLC")](http://agileconsultingllc.com/)
147
176
 
148
- Originally developed by [platanus](http://platan.us).
149
- [<img src="http://platan.us/gravatar_with_text.png" alt="Platanus" width="125"/>](http://platan.us/)
177
+ Originally developed by [Platanus](http://platan.us).
150
178
 
151
179
  ## License
152
180
 
@@ -1,10 +1,11 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = "capistrano3-delayed-job"
7
- spec.version = "1.7.3"
8
+ spec.version = "1.7.4"
8
9
  spec.authors = ["Rob Biedenharn",
9
10
  "Juan Ignacio Donoso",
10
11
  "Agustin Feuerhake",
@@ -1,6 +1,6 @@
1
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
2
- # rubocop:disable Metrics/PerceivedComplexity, Style/EmptyLinesAroundBlockBody
3
- # rubocop:disable Style/SpaceInsideParens
1
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/BlockLength
2
+ # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
3
+ # rubocop:disable Style/SpaceInsideParens, Style/EmptyLinesAroundBlockBody
4
4
 
5
5
  namespace :delayed_job do
6
6
 
@@ -12,7 +12,10 @@ namespace :delayed_job do
12
12
  args << "--prefix=#{fetch(:delayed_job_prefix)}" unless fetch(:delayed_job_prefix).nil?
13
13
  args << "--pid-dir=#{fetch(:delayed_job_pid_dir)}" unless fetch(:delayed_job_pid_dir).nil?
14
14
  args << "--log-dir=#{fetch(:delayed_log_dir)}" unless fetch(:delayed_log_dir).nil?
15
- unless fetch(:delayed_job_pools).nil?
15
+ if fetch(:delayed_job_pools_per_server, nil)
16
+ server = capture(:hostname)
17
+ args << fetch(:delayed_job_pools_per_server, {})[server].map {|k,v| "--pool='#{k}:#{v}'" }.join(' ')
18
+ elsif fetch(:delayed_job_pools, nil)
16
19
  args << fetch(:delayed_job_pools, {}).map {|k,v| "--pool='#{k}:#{v}'" }.join(' ')
17
20
  end
18
21
  args.join(' ')
@@ -63,19 +66,22 @@ namespace :delayed_job do
63
66
 
64
67
  desc 'Restart the delayed_job process'
65
68
  task :restart do
66
- if fetch(:delayed_job_default_hooks)
67
- on roles(delayed_job_roles) do
68
- within release_path do
69
- with rails_env: fetch(:rails_env) do
70
- execute :bundle, :exec, delayed_job_bin, delayed_job_args, :restart
71
- end
69
+ on roles(delayed_job_roles) do
70
+ within release_path do
71
+ with rails_env: fetch(:rails_env) do
72
+ execute :bundle, :exec, delayed_job_bin, delayed_job_args, :restart
72
73
  end
73
74
  end
74
75
  end
75
76
  end
76
77
 
78
+ desc 'Default task - conditionally restart'
79
+ task :default do
80
+ invoke 'delayed_job:restart' if fetch(:delayed_job_default_hooks, true)
81
+ end
82
+
77
83
  if Rake::Task.task_defined?('deploy:published')
78
- after 'deploy:published', 'delayed_job:restart'
84
+ after 'deploy:published', 'delayed_job:default'
79
85
  end
80
86
  end
81
87
 
@@ -84,6 +90,7 @@ namespace :load do
84
90
  set :delayed_job_workers, 1
85
91
  set :delayed_job_queues, nil
86
92
  set :delayed_job_pools, nil
93
+ set :delayed_job_pools_per_server, nil
87
94
  set :delayed_job_roles, :app
88
95
  set :delayed_job_bin_path, 'bin'
89
96
  set :delayed_job_monitor, nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-delayed-job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Biedenharn
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-01-31 00:00:00.000000000 Z
14
+ date: 2017-10-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: capistrano
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.6.8
126
+ rubygems_version: 2.6.13
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Adds support for delayed_jobs to Capistrano 3.x