delayed_job 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/delayed/command.rb +1 -1
  2. data/lib/delayed/worker.rb +15 -11
  3. metadata +105 -105
@@ -47,7 +47,7 @@ module Delayed
47
47
  @monitor = true
48
48
  end
49
49
  opts.on('--sleep-delay N', "Amount of time to sleep when no jobs are found") do |n|
50
- @options[:sleep_delay] = n
50
+ @options[:sleep_delay] = n.to_i
51
51
  end
52
52
  opts.on('--read-ahead N', "Number of jobs from the queue to consider") do |n|
53
53
  @options[:read_ahead] = n
@@ -16,7 +16,14 @@ module Delayed
16
16
  DEFAULT_QUEUES = []
17
17
  DEFAULT_READ_AHEAD = 5
18
18
 
19
- cattr_accessor :min_priority, :max_priority, :max_attempts, :max_run_time, :default_priority, :sleep_delay, :logger, :delay_jobs, :queues, :read_ahead
19
+ cattr_accessor :min_priority, :max_priority, :max_attempts, :max_run_time,
20
+ :default_priority, :sleep_delay, :logger, :delay_jobs, :queues,
21
+ :read_ahead, :plugins, :destroy_failed_jobs
22
+
23
+ cattr_reader :backend
24
+
25
+ # name_prefix is ignored if name is set directly
26
+ attr_accessor :name_prefix
20
27
 
21
28
  def self.reset
22
29
  self.sleep_delay = DEFAULT_SLEEP_DELAY
@@ -31,12 +38,10 @@ module Delayed
31
38
  reset
32
39
 
33
40
  # Add or remove plugins in this list before the worker is instantiated
34
- cattr_accessor :plugins
35
41
  self.plugins = [Delayed::Plugins::ClearLocks]
36
42
 
37
43
  # By default failed jobs are destroyed after too many attempts. If you want to keep them around
38
44
  # (perhaps to inspect the reason for the failure), set this to false.
39
- cattr_accessor :destroy_failed_jobs
40
45
  self.destroy_failed_jobs = true
41
46
 
42
47
  self.logger = if defined?(Rails)
@@ -45,11 +50,6 @@ module Delayed
45
50
  RAILS_DEFAULT_LOGGER
46
51
  end
47
52
 
48
- # name_prefix is ignored if name is set directly
49
- attr_accessor :name_prefix
50
-
51
- cattr_reader :backend
52
-
53
53
  def self.backend=(backend)
54
54
  if backend.is_a? Symbol
55
55
  require "delayed/serialization/#{backend}"
@@ -135,7 +135,7 @@ module Delayed
135
135
 
136
136
  count = result.sum
137
137
 
138
- break if @exit
138
+ break if stop?
139
139
 
140
140
  if count.zero?
141
141
  sleep(self.class.sleep_delay)
@@ -144,7 +144,7 @@ module Delayed
144
144
  end
145
145
  end
146
146
 
147
- break if @exit
147
+ break if stop?
148
148
  end
149
149
  end
150
150
  end
@@ -153,6 +153,10 @@ module Delayed
153
153
  @exit = true
154
154
  end
155
155
 
156
+ def stop?
157
+ !!@exit
158
+ end
159
+
156
160
  # Do num jobs and return stats on success/failure.
157
161
  # Exit early if interrupted.
158
162
  def work_off(num = 100)
@@ -167,7 +171,7 @@ module Delayed
167
171
  else
168
172
  break # leave if no work could be done
169
173
  end
170
- break if $exit # leave if we're exiting
174
+ break if stop? # leave if we're exiting
171
175
  end
172
176
 
173
177
  return [success, failure]
metadata CHANGED
@@ -1,128 +1,130 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: delayed_job
3
- version: !ruby/object:Gem::Version
4
- hash: 3
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.3
5
5
  prerelease:
6
- segments:
7
- - 3
8
- - 0
9
- - 2
10
- version: 3.0.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Matt Griffin
14
9
  - Brian Ryckbost
15
10
  - Steve Richert
16
11
  - Chris Gaffney
17
12
  - Brandon Keepers
18
- - "Tobias L\xC3\xBCtke"
13
+ - Tobias Lütke
19
14
  autorequire:
20
15
  bindir: bin
21
16
  cert_chain: []
22
-
23
- date: 2012-04-03 00:00:00 Z
24
- dependencies:
25
- - !ruby/object:Gem::Dependency
26
- version_requirements: &id001 !ruby/object:Gem::Requirement
17
+ date: 2012-05-25 00:00:00.000000000 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: activesupport
21
+ requirement: !ruby/object:Gem::Requirement
27
22
  none: false
28
- requirements:
23
+ requirements:
29
24
  - - ~>
30
- - !ruby/object:Gem::Version
31
- hash: 7
32
- segments:
33
- - 3
34
- - 0
35
- version: "3.0"
36
- requirement: *id001
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
37
27
  type: :runtime
38
28
  prerelease: false
39
- name: activesupport
40
- - !ruby/object:Gem::Dependency
41
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
42
30
  none: false
43
- requirements:
31
+ requirements:
44
32
  - - ~>
45
- - !ruby/object:Gem::Version
46
- hash: 7
47
- segments:
48
- - 3
49
- - 0
50
- version: "3.0"
51
- requirement: *id002
52
- type: :development
53
- prerelease: false
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
35
+ - !ruby/object:Gem::Dependency
54
36
  name: activerecord
55
- - !ruby/object:Gem::Dependency
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
37
+ requirement: !ruby/object:Gem::Requirement
57
38
  none: false
58
- requirements:
39
+ requirements:
59
40
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 7
62
- segments:
63
- - 3
64
- - 0
65
- version: "3.0"
66
- requirement: *id003
41
+ - !ruby/object:Gem::Version
42
+ version: '3.0'
67
43
  type: :development
68
44
  prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ~>
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
51
+ - !ruby/object:Gem::Dependency
69
52
  name: actionmailer
70
- - !ruby/object:Gem::Dependency
71
- version_requirements: &id004 !ruby/object:Gem::Requirement
53
+ requirement: !ruby/object:Gem::Requirement
72
54
  none: false
73
- requirements:
55
+ requirements:
74
56
  - - ~>
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 2
79
- - 0
80
- version: "2.0"
81
- requirement: *id004
57
+ - !ruby/object:Gem::Version
58
+ version: '3.0'
82
59
  type: :development
83
60
  prerelease: false
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: '3.0'
67
+ - !ruby/object:Gem::Dependency
84
68
  name: rspec
85
- - !ruby/object:Gem::Dependency
86
- version_requirements: &id005 !ruby/object:Gem::Requirement
69
+ requirement: !ruby/object:Gem::Requirement
87
70
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
95
- requirement: *id005
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: '2.0'
96
75
  type: :development
97
76
  prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
98
84
  name: rake
99
- - !ruby/object:Gem::Dependency
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
85
+ requirement: !ruby/object:Gem::Requirement
101
86
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
109
- requirement: *id006
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
110
91
  type: :development
111
92
  prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ - !ruby/object:Gem::Dependency
112
100
  name: simplecov
113
- description: |-
114
- Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.
115
-
116
- This gem is collectiveidea's fork (http://github.com/collectiveidea/delayed_job).
117
- email:
101
+ requirement: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ description: ! 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously
116
+ executing longer tasks in the background. It is a direct extraction from Shopify
117
+ where the job table is responsible for a multitude of core tasks.
118
+
119
+
120
+ This gem is collectiveidea''s fork (http://github.com/collectiveidea/delayed_job).'
121
+ email:
118
122
  - brian@collectiveidea.com
119
123
  executables: []
120
-
121
124
  extensions: []
122
-
123
- extra_rdoc_files:
125
+ extra_rdoc_files:
124
126
  - README.textile
125
- files:
127
+ files:
126
128
  - contrib/delayed_job.monitrc
127
129
  - contrib/delayed_job_multiple.monitrc
128
130
  - lib/delayed/backend/base.rb
@@ -167,41 +169,39 @@ files:
167
169
  - README.textile
168
170
  homepage: http://github.com/collectiveidea/delayed_job
169
171
  licenses: []
170
-
171
172
  post_install_message:
172
- rdoc_options:
173
+ rdoc_options:
173
174
  - --main
174
175
  - README.textile
175
176
  - --inline-source
176
177
  - --line-numbers
177
- require_paths:
178
+ require_paths:
178
179
  - lib
179
- required_ruby_version: !ruby/object:Gem::Requirement
180
+ required_ruby_version: !ruby/object:Gem::Requirement
180
181
  none: false
181
- requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- hash: 3
185
- segments:
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ segments:
186
187
  - 0
187
- version: "0"
188
- required_rubygems_version: !ruby/object:Gem::Requirement
188
+ hash: -2627089145995609867
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- hash: 3
194
- segments:
191
+ requirements:
192
+ - - ! '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ segments:
195
196
  - 0
196
- version: "0"
197
+ hash: -2627089145995609867
197
198
  requirements: []
198
-
199
199
  rubyforge_project:
200
- rubygems_version: 1.8.10
200
+ rubygems_version: 1.8.24
201
201
  signing_key:
202
202
  specification_version: 3
203
203
  summary: Database-backed asynchronous priority queue system -- Extracted from Shopify
204
- test_files:
204
+ test_files:
205
205
  - spec/autoloaded/clazz.rb
206
206
  - spec/autoloaded/instance_clazz.rb
207
207
  - spec/autoloaded/instance_struct.rb