delayed_job 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,10 +30,6 @@ module Delayed
30
30
  }
31
31
  named_scope :by_priority, :order => 'priority ASC, run_at ASC'
32
32
 
33
- named_scope :locked_by_worker, lambda{|worker_name, max_run_time|
34
- {:conditions => ['locked_by = ? AND locked_at > ?', worker_name, db_time_now - max_run_time]}
35
- }
36
-
37
33
  def self.after_fork
38
34
  ::ActiveRecord::Base.connection.reconnect!
39
35
  end
@@ -42,33 +38,15 @@ module Delayed
42
38
  def self.clear_locks!(worker_name)
43
39
  update_all("locked_by = null, locked_at = null", ["locked_by = ?", worker_name])
44
40
  end
45
-
46
- def self.jobs_available_to_worker(worker_name, max_run_time)
41
+
42
+ # Find a few candidate jobs to run (in case some immediately get locked by others).
43
+ def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
47
44
  scope = self.ready_to_run(worker_name, max_run_time)
48
45
  scope = scope.scoped(:conditions => ['priority >= ?', Worker.min_priority]) if Worker.min_priority
49
46
  scope = scope.scoped(:conditions => ['priority <= ?', Worker.max_priority]) if Worker.max_priority
50
- scope.by_priority
51
- end
52
-
53
- # Reserve a single job in a single update query. This causes workers to serialize on the
54
- # database and avoids contention.
55
- def self.reserve(worker, max_run_time = Worker.max_run_time)
56
- affected_rows = 0
57
- ::ActiveRecord::Base.silence do
58
- affected_rows = update_all(["locked_at = ?, locked_by = ?", db_time_now, worker.name], jobs_available_to_worker(worker.name, max_run_time).scope(:find)[:conditions], :limit => 1)
59
- end
60
-
61
- if affected_rows == 1
62
- locked_by_worker(worker.name, max_run_time).first
63
- else
64
- nil
65
- end
66
- end
67
-
68
- # Find a few candidate jobs to run (in case some immediately get locked by others).
69
- def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
47
+
70
48
  ::ActiveRecord::Base.silence do
71
- jobs_available_to_worker(worker_name, max_run_time).all(:limit => limit)
49
+ scope.by_priority.all(:limit => limit)
72
50
  end
73
51
  end
74
52
 
@@ -172,7 +172,7 @@ shared_examples_for 'a backend' do
172
172
  @job_copy_for_worker_2.lock_exclusively!(4.hours, 'worker2').should == false
173
173
  end
174
174
  end
175
-
175
+
176
176
  describe "reserve" do
177
177
  before do
178
178
  Delayed::Worker.max_run_time = 2.minutes
@@ -20,7 +20,7 @@ Dir.glob("#{File.dirname(__FILE__)}/setup/*.rb") do |backend|
20
20
  require "setup/#{backend}"
21
21
  require "backend/#{backend}_job_spec"
22
22
  BACKENDS << backend.to_sym
23
- rescue LoadError
23
+ rescue LoadError, Exception
24
24
  puts "Unable to load #{backend} backend! #{$!}"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,169 +1,202 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
4
  prerelease: false
6
5
  segments:
7
6
  - 2
8
7
  - 0
9
- - 5
10
- version: 2.0.5
8
+ - 6
9
+ version: 2.0.6
11
10
  platform: ruby
12
11
  authors:
12
+ - Chris Gaffney
13
13
  - Brandon Keepers
14
14
  - "Tobias L\xC3\xBCtke"
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-12-01 00:00:00 -05:00
19
+ date: 2011-01-20 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: daemons
24
- prerelease: false
25
24
  requirement: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
30
- hash: 3
31
29
  segments:
32
30
  - 0
33
31
  version: "0"
34
32
  type: :runtime
33
+ prerelease: false
35
34
  version_requirements: *id001
36
35
  - !ruby/object:Gem::Dependency
37
36
  name: rspec
38
- prerelease: false
39
37
  requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
- - - ">="
40
+ - - <
43
41
  - !ruby/object:Gem::Version
44
- hash: 3
45
42
  segments:
43
+ - 2
46
44
  - 0
47
- version: "0"
45
+ version: "2.0"
48
46
  type: :development
47
+ prerelease: false
49
48
  version_requirements: *id002
50
49
  - !ruby/object:Gem::Dependency
51
- name: sqlite3-ruby
52
- prerelease: false
50
+ name: rake
53
51
  requirement: &id003 !ruby/object:Gem::Requirement
54
52
  none: false
55
53
  requirements:
56
54
  - - ">="
57
55
  - !ruby/object:Gem::Version
58
- hash: 3
59
56
  segments:
60
57
  - 0
61
58
  version: "0"
62
59
  type: :development
60
+ prerelease: false
63
61
  version_requirements: *id003
64
62
  - !ruby/object:Gem::Dependency
65
- name: mongo_mapper
66
- prerelease: false
63
+ name: rails
67
64
  requirement: &id004 !ruby/object:Gem::Requirement
68
65
  none: false
69
66
  requirements:
70
- - - ">="
67
+ - - <
71
68
  - !ruby/object:Gem::Version
72
- hash: 3
73
69
  segments:
70
+ - 3
74
71
  - 0
75
- version: "0"
72
+ version: "3.0"
76
73
  type: :development
74
+ prerelease: false
77
75
  version_requirements: *id004
78
76
  - !ruby/object:Gem::Dependency
79
- name: dm-core
80
- prerelease: false
77
+ name: sqlite3
81
78
  requirement: &id005 !ruby/object:Gem::Requirement
82
79
  none: false
83
80
  requirements:
84
81
  - - ">="
85
82
  - !ruby/object:Gem::Version
86
- hash: 3
87
83
  segments:
88
84
  - 0
89
85
  version: "0"
90
86
  type: :development
87
+ prerelease: false
91
88
  version_requirements: *id005
92
89
  - !ruby/object:Gem::Dependency
93
- name: dm-observer
94
- prerelease: false
90
+ name: mysql
95
91
  requirement: &id006 !ruby/object:Gem::Requirement
96
92
  none: false
97
93
  requirements:
98
94
  - - ">="
99
95
  - !ruby/object:Gem::Version
100
- hash: 3
101
96
  segments:
102
97
  - 0
103
98
  version: "0"
104
99
  type: :development
100
+ prerelease: false
105
101
  version_requirements: *id006
106
102
  - !ruby/object:Gem::Dependency
107
- name: dm-aggregates
108
- prerelease: false
103
+ name: mongo_mapper
109
104
  requirement: &id007 !ruby/object:Gem::Requirement
110
105
  none: false
111
106
  requirements:
112
107
  - - ">="
113
108
  - !ruby/object:Gem::Version
114
- hash: 3
115
109
  segments:
116
110
  - 0
117
111
  version: "0"
118
112
  type: :development
113
+ prerelease: false
119
114
  version_requirements: *id007
120
115
  - !ruby/object:Gem::Dependency
121
- name: dm-validations
122
- prerelease: false
116
+ name: dm-core
123
117
  requirement: &id008 !ruby/object:Gem::Requirement
124
118
  none: false
125
119
  requirements:
126
120
  - - ">="
127
121
  - !ruby/object:Gem::Version
128
- hash: 3
129
122
  segments:
130
123
  - 0
131
124
  version: "0"
132
125
  type: :development
126
+ prerelease: false
133
127
  version_requirements: *id008
134
128
  - !ruby/object:Gem::Dependency
135
- name: do_sqlite3
136
- prerelease: false
129
+ name: dm-observer
137
130
  requirement: &id009 !ruby/object:Gem::Requirement
138
131
  none: false
139
132
  requirements:
140
133
  - - ">="
141
134
  - !ruby/object:Gem::Version
142
- hash: 3
143
135
  segments:
144
136
  - 0
145
137
  version: "0"
146
138
  type: :development
139
+ prerelease: false
147
140
  version_requirements: *id009
148
141
  - !ruby/object:Gem::Dependency
149
- name: database_cleaner
150
- prerelease: false
142
+ name: dm-aggregates
151
143
  requirement: &id010 !ruby/object:Gem::Requirement
152
144
  none: false
153
145
  requirements:
154
146
  - - ">="
155
147
  - !ruby/object:Gem::Version
156
- hash: 3
157
148
  segments:
158
149
  - 0
159
150
  version: "0"
160
151
  type: :development
152
+ prerelease: false
161
153
  version_requirements: *id010
154
+ - !ruby/object:Gem::Dependency
155
+ name: dm-validations
156
+ requirement: &id011 !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ type: :development
165
+ prerelease: false
166
+ version_requirements: *id011
167
+ - !ruby/object:Gem::Dependency
168
+ name: do_sqlite3
169
+ requirement: &id012 !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ segments:
175
+ - 0
176
+ version: "0"
177
+ type: :development
178
+ prerelease: false
179
+ version_requirements: *id012
180
+ - !ruby/object:Gem::Dependency
181
+ name: database_cleaner
182
+ requirement: &id013 !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ segments:
188
+ - 0
189
+ version: "0"
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: *id013
162
193
  description: |-
163
194
  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.
164
195
 
165
196
  This gem is collectiveidea's fork (http://github.com/collectiveidea/delayed_job).
166
- email: tobi@leetsoft.com
197
+ email:
198
+ - chris@collectiveidea.com
199
+ - brandon@opensoul.org
167
200
  executables: []
168
201
 
169
202
  extensions: []
@@ -171,21 +204,8 @@ extensions: []
171
204
  extra_rdoc_files:
172
205
  - README.textile
173
206
  files:
174
- - .gitignore
175
- - .rvmrc
176
- - CHANGELOG
177
- - MIT-LICENSE
178
- - README.textile
179
- - Rakefile
180
- - VERSION
181
- - benchmarks.rb
182
207
  - contrib/delayed_job.monitrc
183
208
  - contrib/delayed_job_multiple.monitrc
184
- - delayed_job.gemspec
185
- - generators/delayed_job/delayed_job_generator.rb
186
- - generators/delayed_job/templates/migration.rb
187
- - generators/delayed_job/templates/script
188
- - init.rb
189
209
  - lib/delayed/backend/active_record.rb
190
210
  - lib/delayed/backend/base.rb
191
211
  - lib/delayed/backend/data_mapper.rb
@@ -198,7 +218,6 @@ files:
198
218
  - lib/delayed/tasks.rb
199
219
  - lib/delayed/worker.rb
200
220
  - lib/delayed_job.rb
201
- - rails/init.rb
202
221
  - recipes/delayed_job.rb
203
222
  - spec/backend/active_record_job_spec.rb
204
223
  - spec/backend/data_mapper_job_spec.rb
@@ -214,7 +233,8 @@ files:
214
233
  - spec/spec_helper.rb
215
234
  - spec/story_spec.rb
216
235
  - spec/worker_spec.rb
217
- - tasks/jobs.rake
236
+ - MIT-LICENSE
237
+ - README.textile
218
238
  has_rdoc: true
219
239
  homepage: http://github.com/collectiveidea/delayed_job
220
240
  licenses: []
@@ -232,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
252
  requirements:
233
253
  - - ">="
234
254
  - !ruby/object:Gem::Version
235
- hash: 3
255
+ hash: 3581009540733593497
236
256
  segments:
237
257
  - 0
238
258
  version: "0"
@@ -241,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
261
  requirements:
242
262
  - - ">="
243
263
  - !ruby/object:Gem::Version
244
- hash: 3
264
+ hash: 3581009540733593497
245
265
  segments:
246
266
  - 0
247
267
  version: "0"
@@ -253,8 +273,17 @@ signing_key:
253
273
  specification_version: 3
254
274
  summary: Database-backed asynchronous priority queue system -- Extracted from Shopify
255
275
  test_files:
276
+ - spec/backend/active_record_job_spec.rb
277
+ - spec/backend/data_mapper_job_spec.rb
278
+ - spec/backend/mongo_mapper_job_spec.rb
279
+ - spec/backend/shared_backend_spec.rb
256
280
  - spec/delayed_method_spec.rb
257
281
  - spec/message_sending_spec.rb
258
282
  - spec/performable_method_spec.rb
283
+ - spec/sample_jobs.rb
284
+ - spec/setup/active_record.rb
285
+ - spec/setup/data_mapper.rb
286
+ - spec/setup/mongo_mapper.rb
287
+ - spec/spec_helper.rb
259
288
  - spec/story_spec.rb
260
289
  - spec/worker_spec.rb
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- .rvmrc
2
- *.gem
3
- *.swp
data/CHANGELOG DELETED
@@ -1,57 +0,0 @@
1
- 2.0.5 - 2010-12-01
2
- * Added #reschedule_at hook on payload to determine when the job should be rescheduled [backported from 2.1]
3
- * Added --sleep-delay command line option [backported from 2.1]
4
- * Added 'delayed_job_server_role' Capistrano variable to allow delayed_job to run on its own worker server
5
- set :delayed_job_server_role, :worker
6
- * Changed AR backend to reserve jobs using an UPDATE query to reduce worker contention [backported from 2.1]
7
-
8
- 2.0.4 - 2010-11-14
9
- * Fix issue where dirty tracking prevented job from being properly unlocked
10
- * Add delayed_job_args variable for Capistrano recipe to allow configuration of started workers (e.g. "-n 2 --max-priority 10")
11
- * Added options to handle_asynchronously
12
- * Added Delayed::Worker.default_priority
13
- * Allow private methods to be delayed
14
- * Fixes for Ruby 1.9
15
- * Added -m command line option to start a monitor process
16
- * normalize logging in worker
17
- * Deprecate #send_later and #send_at in favor of new #delay method
18
- * Added @#delay@ to Object that allows you to delay any method and pass options:
19
- options = {:priority => 19, :run_at => 5.minutes.from_now}
20
- UserMailer.delay(options).deliver_confirmation(@user)
21
-
22
- 2.0.3 - 2010-04-16
23
-
24
- * Fix initialization for Rails 2.x
25
-
26
- 2.0.2 - 2010-04-08
27
-
28
- * Fixes to Mongo Mapper backend [ "14be7a24":http://github.com/collectiveidea/delayed_job/commit/14be7a24, "dafd5f46":http://github.com/collectiveidea/delayed_job/commit/dafd5f46, "54d40913":http://github.com/collectiveidea/delayed_job/commit/54d40913 ]
29
- * DataMapper backend performance improvements [ "93833cce":http://github.com/collectiveidea/delayed_job/commit/93833cce, "e9b1573e":http://github.com/collectiveidea/delayed_job/commit/e9b1573e, "37a16d11":http://github.com/collectiveidea/delayed_job/commit/37a16d11, "803f2bfa":http://github.com/collectiveidea/delayed_job/commit/803f2bfa ]
30
- * Fixed Delayed::Command to create tmp/pids directory [ "8ec8ca41":http://github.com/collectiveidea/delayed_job/commit/8ec8ca41 ]
31
- * Railtie to perform Rails 3 initialization [ "3e0fc41f":http://github.com/collectiveidea/delayed_job/commit/3e0fc41f ]
32
- * Added on_permanent_failure hook [ "d2f14cd6":http://github.com/collectiveidea/delayed_job/commit/d2f14cd6 ]
33
-
34
- 2.0.1 - 2010-04-03
35
- * Bug fix for using ActiveRecord backend with daemon [martinbtt]
36
-
37
- 2.0.0 - 2010-04-03
38
- * Multiple backend support (See README for more details)
39
- * Added MongoMapper backend [zbelzer, moneypools]
40
- * Added DataMapper backend [lpetre]
41
- * Reverse priority so the jobs table can be indexed. Lower numbers have higher priority. The default priority is 0, so increase it for jobs that are not important.
42
- * Move most of the heavy lifting from Job to Worker (#work_off, #reschedule, #run, #min_priority, #max_priority, #max_run_time, #max_attempts, #worker_name) [albus522]
43
- * Remove EvaledJob. Implement your own if you need this functionality.
44
- * Only use Time.zone if it is set. Closes #20
45
- * Fix for last_error recording when destroy_failed_jobs = false, max_attempts = 1
46
- * Implemented worker name_prefix to maintain dynamic nature of pid detection
47
- * Some Rails 3 compatibility fixes [fredwu]
48
-
49
- 1.8.5 - 2010-03-15
50
-
51
- * Set auto_flushing=true on Rails logger to fix logging in production
52
- * Fix error message when trying to send_later on a method that doesn't exist
53
- * Don't use rails_env in capistrano if it's not set. closes #22
54
- * Delayed job should append to delayed_job.log not overwrite
55
- * Version bump to 1.8.5
56
- * fixing Time.now to be Time.zone.now if set to honor the app set local TimeZone
57
- * Replaced @Worker::SLEEP@, @Job::MAX_ATTEMPTS@, and @Job::MAX_RUN_TIME@ with class methods that can be overridden.
data/Rakefile DELETED
@@ -1,45 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- begin
3
- require 'jeweler'
4
- rescue LoadError
5
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
6
- exit 1
7
- end
8
-
9
- Jeweler::Tasks.new do |s|
10
- s.name = "delayed_job"
11
- s.summary = "Database-backed asynchronous priority queue system -- Extracted from Shopify"
12
- s.email = "tobi@leetsoft.com"
13
- s.homepage = "http://github.com/collectiveidea/delayed_job"
14
- s.description = "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.\n\nThis gem is collectiveidea's fork (http://github.com/collectiveidea/delayed_job)."
15
- s.authors = ["Brandon Keepers", "Tobias Lütke"]
16
-
17
- s.has_rdoc = true
18
- s.rdoc_options = ["--main", "README.textile", "--inline-source", "--line-numbers"]
19
- s.extra_rdoc_files = ["README.textile"]
20
-
21
- s.test_files = Dir['spec/*_spec.rb']
22
-
23
- s.add_dependency "daemons"
24
- s.add_development_dependency "rspec"
25
- s.add_development_dependency "sqlite3-ruby"
26
- s.add_development_dependency "mongo_mapper"
27
- s.add_development_dependency "dm-core"
28
- s.add_development_dependency "dm-observer"
29
- s.add_development_dependency "dm-aggregates"
30
- s.add_development_dependency "dm-validations"
31
- s.add_development_dependency "do_sqlite3"
32
- s.add_development_dependency "database_cleaner"
33
- end
34
-
35
- require 'spec/rake/spectask'
36
- desc 'Run the specs'
37
- Spec::Rake::SpecTask.new(:spec) do |t|
38
- t.libs << 'lib'
39
- t.pattern = 'spec/*_spec.rb'
40
- t.verbose = false
41
- end
42
-
43
- task :spec => :check_dependencies
44
- task :default => :spec
45
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.0.5
@@ -1,33 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__) + '/lib')
2
- require 'rubygems'
3
- require 'logger'
4
- require 'delayed_job'
5
- require 'benchmark'
6
-
7
- RAILS_ENV = 'test'
8
-
9
- Delayed::Worker.logger = Logger.new('/dev/null')
10
-
11
- BACKENDS = []
12
- Dir.glob("#{File.dirname(__FILE__)}/spec/setup/*.rb") do |backend|
13
- begin
14
- backend = File.basename(backend, '.rb')
15
- require "spec/setup/#{backend}"
16
- BACKENDS << backend.to_sym
17
- rescue LoadError
18
- puts "Unable to load #{backend} backend! #{$!}"
19
- end
20
- end
21
-
22
-
23
- Benchmark.bm(10) do |x|
24
- BACKENDS.each do |backend|
25
- require "spec/setup/#{backend}"
26
- Delayed::Worker.backend = backend
27
-
28
- n = 10000
29
- n.times { "foo".delay.length }
30
-
31
- x.report(backend.to_s) { Delayed::Worker.new(:quiet => true).work_off(n) }
32
- end
33
- end
@@ -1,119 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{delayed_job}
8
- s.version = "2.0.5"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Brandon Keepers", "Tobias L\303\274tke"]
12
- s.date = %q{2010-12-01}
13
- s.description = %q{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.
14
-
15
- This gem is collectiveidea's fork (http://github.com/collectiveidea/delayed_job).}
16
- s.email = %q{tobi@leetsoft.com}
17
- s.extra_rdoc_files = [
18
- "README.textile"
19
- ]
20
- s.files = [
21
- ".gitignore",
22
- ".rvmrc",
23
- "CHANGELOG",
24
- "MIT-LICENSE",
25
- "README.textile",
26
- "Rakefile",
27
- "VERSION",
28
- "benchmarks.rb",
29
- "contrib/delayed_job.monitrc",
30
- "contrib/delayed_job_multiple.monitrc",
31
- "delayed_job.gemspec",
32
- "generators/delayed_job/delayed_job_generator.rb",
33
- "generators/delayed_job/templates/migration.rb",
34
- "generators/delayed_job/templates/script",
35
- "init.rb",
36
- "lib/delayed/backend/active_record.rb",
37
- "lib/delayed/backend/base.rb",
38
- "lib/delayed/backend/data_mapper.rb",
39
- "lib/delayed/backend/mongo_mapper.rb",
40
- "lib/delayed/command.rb",
41
- "lib/delayed/message_sending.rb",
42
- "lib/delayed/performable_method.rb",
43
- "lib/delayed/railtie.rb",
44
- "lib/delayed/recipes.rb",
45
- "lib/delayed/tasks.rb",
46
- "lib/delayed/worker.rb",
47
- "lib/delayed_job.rb",
48
- "rails/init.rb",
49
- "recipes/delayed_job.rb",
50
- "spec/backend/active_record_job_spec.rb",
51
- "spec/backend/data_mapper_job_spec.rb",
52
- "spec/backend/mongo_mapper_job_spec.rb",
53
- "spec/backend/shared_backend_spec.rb",
54
- "spec/delayed_method_spec.rb",
55
- "spec/message_sending_spec.rb",
56
- "spec/performable_method_spec.rb",
57
- "spec/sample_jobs.rb",
58
- "spec/setup/active_record.rb",
59
- "spec/setup/data_mapper.rb",
60
- "spec/setup/mongo_mapper.rb",
61
- "spec/spec_helper.rb",
62
- "spec/story_spec.rb",
63
- "spec/worker_spec.rb",
64
- "tasks/jobs.rake"
65
- ]
66
- s.homepage = %q{http://github.com/collectiveidea/delayed_job}
67
- s.rdoc_options = ["--main", "README.textile", "--inline-source", "--line-numbers"]
68
- s.require_paths = ["lib"]
69
- s.rubygems_version = %q{1.3.7}
70
- s.summary = %q{Database-backed asynchronous priority queue system -- Extracted from Shopify}
71
- s.test_files = [
72
- "spec/delayed_method_spec.rb",
73
- "spec/message_sending_spec.rb",
74
- "spec/performable_method_spec.rb",
75
- "spec/story_spec.rb",
76
- "spec/worker_spec.rb"
77
- ]
78
-
79
- if s.respond_to? :specification_version then
80
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
81
- s.specification_version = 3
82
-
83
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
84
- s.add_runtime_dependency(%q<daemons>, [">= 0"])
85
- s.add_development_dependency(%q<rspec>, [">= 0"])
86
- s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
87
- s.add_development_dependency(%q<mongo_mapper>, [">= 0"])
88
- s.add_development_dependency(%q<dm-core>, [">= 0"])
89
- s.add_development_dependency(%q<dm-observer>, [">= 0"])
90
- s.add_development_dependency(%q<dm-aggregates>, [">= 0"])
91
- s.add_development_dependency(%q<dm-validations>, [">= 0"])
92
- s.add_development_dependency(%q<do_sqlite3>, [">= 0"])
93
- s.add_development_dependency(%q<database_cleaner>, [">= 0"])
94
- else
95
- s.add_dependency(%q<daemons>, [">= 0"])
96
- s.add_dependency(%q<rspec>, [">= 0"])
97
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
98
- s.add_dependency(%q<mongo_mapper>, [">= 0"])
99
- s.add_dependency(%q<dm-core>, [">= 0"])
100
- s.add_dependency(%q<dm-observer>, [">= 0"])
101
- s.add_dependency(%q<dm-aggregates>, [">= 0"])
102
- s.add_dependency(%q<dm-validations>, [">= 0"])
103
- s.add_dependency(%q<do_sqlite3>, [">= 0"])
104
- s.add_dependency(%q<database_cleaner>, [">= 0"])
105
- end
106
- else
107
- s.add_dependency(%q<daemons>, [">= 0"])
108
- s.add_dependency(%q<rspec>, [">= 0"])
109
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
110
- s.add_dependency(%q<mongo_mapper>, [">= 0"])
111
- s.add_dependency(%q<dm-core>, [">= 0"])
112
- s.add_dependency(%q<dm-observer>, [">= 0"])
113
- s.add_dependency(%q<dm-aggregates>, [">= 0"])
114
- s.add_dependency(%q<dm-validations>, [">= 0"])
115
- s.add_dependency(%q<do_sqlite3>, [">= 0"])
116
- s.add_dependency(%q<database_cleaner>, [">= 0"])
117
- end
118
- end
119
-
@@ -1,22 +0,0 @@
1
- class DelayedJobGenerator < Rails::Generator::Base
2
- default_options :skip_migration => false
3
-
4
- def manifest
5
- record do |m|
6
- m.template 'script', 'script/delayed_job', :chmod => 0755
7
- if !options[:skip_migration] && defined?(ActiveRecord)
8
- m.migration_template "migration.rb", 'db/migrate',
9
- :migration_file_name => "create_delayed_jobs"
10
- end
11
- end
12
- end
13
-
14
- protected
15
-
16
- def add_options!(opt)
17
- opt.separator ''
18
- opt.separator 'Options:'
19
- opt.on("--skip-migration", "Don't generate a migration") { |v| options[:skip_migration] = v }
20
- end
21
-
22
- end
@@ -1,22 +0,0 @@
1
- class CreateDelayedJobs < ActiveRecord::Migration
2
- def self.up
3
- create_table :delayed_jobs, :force => true do |table|
4
- table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
5
- table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
6
- table.text :handler # YAML-encoded string of the object that will do work
7
- table.text :last_error # reason for last failure (See Note below)
8
- table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
9
- table.datetime :locked_at # Set when a client is working on this object
10
- table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
11
- table.string :locked_by # Who is working on this object (if locked)
12
- table.timestamps
13
- end
14
-
15
- add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
16
- add_index :delayed_jobs, :locked_by, :name => 'delayed_jobs_locked_by'
17
- end
18
-
19
- def self.down
20
- drop_table :delayed_jobs
21
- end
22
- end
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
4
- require 'delayed/command'
5
- Delayed::Command.new(ARGV).daemonize
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'rails', 'init')
@@ -1,5 +0,0 @@
1
- require 'delayed_job'
2
-
3
- config.after_initialize do
4
- Delayed::Worker.guess_backend
5
- end
@@ -1 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'delayed', 'tasks'))