delayed_job_on_steroids 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +14 -20
- data/VERSION +1 -1
- data/delayed_job_on_steroids.gemspec +4 -4
- data/lib/delayed_on_steroids/command.rb +3 -1
- data/lib/delayed_on_steroids/tasks.rb +5 -0
- metadata +4 -4
data/README.markdown
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
Delayed::Job (on steroids)
|
2
|
+
==========================
|
2
3
|
|
3
4
|
delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.
|
4
5
|
Amongst those tasks are:
|
@@ -12,7 +13,8 @@ Amongst those tasks are:
|
|
12
13
|
* spam checks
|
13
14
|
|
14
15
|
|
15
|
-
|
16
|
+
Setup
|
17
|
+
-----
|
16
18
|
|
17
19
|
The library evolves around a delayed_jobs table which can be created by using:
|
18
20
|
|
@@ -54,7 +56,8 @@ Here is an example of changing job parameters in Rails:
|
|
54
56
|
end
|
55
57
|
|
56
58
|
|
57
|
-
|
59
|
+
Usage
|
60
|
+
-----
|
58
61
|
|
59
62
|
Jobs are simple ruby objects with a method called perform. Any object which responds to perform can be stuffed into the jobs table.
|
60
63
|
Job objects are serialized to yaml so that they can later be resurrected by the job runner.
|
@@ -74,7 +77,8 @@ There is also a second way to get jobs in the queue: send_later.
|
|
74
77
|
This will simply create a `Delayed::PerformableMethod` job in the jobs table which serializes all the parameters you pass to it. There are some special smarts for active record objects which are stored as their text representation and loaded from the database fresh when the job is actually run later.
|
75
78
|
|
76
79
|
|
77
|
-
|
80
|
+
Running the jobs
|
81
|
+
----------------
|
78
82
|
|
79
83
|
Run `script/generate delayed_job` to add `script/delayed_job`. This script can then be used to manage a process which will start working off jobs.
|
80
84
|
|
@@ -85,12 +89,14 @@ run multiple workers on per computer, but you must give each one a unique name (
|
|
85
89
|
Keep in mind that each worker will check the database at least every 5 seconds.
|
86
90
|
|
87
91
|
|
88
|
-
|
92
|
+
About this fork
|
93
|
+
---------------
|
89
94
|
|
90
95
|
This fork was born to introduce new features to delayed_job, but also to be almost-fully compatible with it.
|
91
96
|
|
92
97
|
|
93
|
-
|
98
|
+
Incompatibilities with tobi's delayed_job
|
99
|
+
-----------------------------------------
|
94
100
|
|
95
101
|
* Database schema:
|
96
102
|
* `last_error` column's type changed from string to text;
|
@@ -98,7 +104,8 @@ h3. Incompatibilities with tobi's delayed_job
|
|
98
104
|
* Invert meaning of `priority` field: job with lesser priority will be executed earlier. See http://www.elevatedcode.com/articles/2009/11/04/speeding-up-delayed-job/ for background.
|
99
105
|
|
100
106
|
|
101
|
-
|
107
|
+
Changes
|
108
|
+
-------
|
102
109
|
|
103
110
|
* 2.0:
|
104
111
|
* Added `script/delayed_job` - runs as daemon, several workers concurrently, minimal and maximal priority, job type, logger, etc.
|
@@ -109,16 +116,3 @@ h3. Changes
|
|
109
116
|
|
110
117
|
* 1.7.5:
|
111
118
|
* Added possibility to run only specific types of jobs.
|
112
|
-
|
113
|
-
|
114
|
-
h3. Original changelog
|
115
|
-
|
116
|
-
* 1.7.0: Added `failed_at` column which can optionally be set after a certain amount of failed job attempts. By default failed job attempts are destroyed after about a month.
|
117
|
-
|
118
|
-
* 1.6.0: Renamed `locked_until` to `locked_at`. We now store when we start a given job instead of how long it will be locked by the worker. This allows us to get a reading on how long a job took to execute.
|
119
|
-
|
120
|
-
* 1.5.0: Job runners can now be run in parallel. Two new database columns are needed: `locked_until` and `locked_by`. This allows us to use pessimistic locking instead of relying on row level locks. This enables us to run as many worker processes as we need to speed up queue processing.
|
121
|
-
|
122
|
-
* 1.2.0: Added `#send_later` to Object for simpler job creation
|
123
|
-
|
124
|
-
* 1.0.0: Initial release
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.1
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{delayed_job_on_steroids}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tobias L\303\274tke", "Aleksey Palazhchenko"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-07}
|
13
13
|
s.description = %q{Delated_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.}
|
14
14
|
s.email = %q{aleksey.palazhchenko@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,10 +48,10 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.rubygems_version = %q{1.3.6}
|
49
49
|
s.summary = %q{Database-backed asynchronous priority queue system, extended and improved}
|
50
50
|
s.test_files = [
|
51
|
-
"spec/
|
51
|
+
"spec/database.rb",
|
52
|
+
"spec/delayed_method_spec.rb",
|
52
53
|
"spec/job_spec.rb",
|
53
54
|
"spec/story_spec.rb",
|
54
|
-
"spec/database.rb",
|
55
55
|
"spec/worker_spec.rb"
|
56
56
|
]
|
57
57
|
|
@@ -59,7 +59,9 @@ module Delayed
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def write_pid
|
62
|
-
|
62
|
+
dir = "#{RAILS_ROOT}/tmp/pids"
|
63
|
+
Dir.mkdir(dir) unless File.exists?(dir)
|
64
|
+
pid = "#{dir}/dj_#{Delayed::Worker.name.parameterize('_')}.pid"
|
63
65
|
File.open(pid, 'w') { |f| f.write(Process.pid) }
|
64
66
|
at_exit { File.delete(pid) if File.exist?(pid) }
|
65
67
|
end
|
@@ -25,4 +25,9 @@ namespace :jobs do
|
|
25
25
|
puts "Scheduled jobs : #{ jobs.count{ |job| not (job.locked? or job.failed?) } }"
|
26
26
|
puts "Failed stored jobs : #{ jobs.count{ |job| job.failed? } }"
|
27
27
|
end
|
28
|
+
|
29
|
+
desc "Start single delayed_job worker"
|
30
|
+
task :work => [:environment] do
|
31
|
+
Delayed::Command.new.run
|
32
|
+
end
|
28
33
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
8
|
+
- 1
|
9
|
+
version: 2.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Tobias L\xC3\xBCtke"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-05-07 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -97,8 +97,8 @@ signing_key:
|
|
97
97
|
specification_version: 3
|
98
98
|
summary: Database-backed asynchronous priority queue system, extended and improved
|
99
99
|
test_files:
|
100
|
+
- spec/database.rb
|
100
101
|
- spec/delayed_method_spec.rb
|
101
102
|
- spec/job_spec.rb
|
102
103
|
- spec/story_spec.rb
|
103
|
-
- spec/database.rb
|
104
104
|
- spec/worker_spec.rb
|