delayed_job 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/delayed/command.rb +4 -0
- data/lib/delayed/yaml_ext.rb +2 -1
- data/spec/yaml_ext_spec.rb +18 -3
- metadata +51 -43
data/lib/delayed/command.rb
CHANGED
@@ -47,6 +47,9 @@ module Delayed
|
|
47
47
|
opts.on('--sleep-delay N', "Amount of time to sleep when no jobs are found") do |n|
|
48
48
|
@options[:sleep_delay] = n
|
49
49
|
end
|
50
|
+
opts.on('-p', '--prefix NAME', "String to be prefixed to worker process names") do |prefix|
|
51
|
+
@options[:prefix] = prefix
|
52
|
+
end
|
50
53
|
end
|
51
54
|
@args = opts.parse!(args)
|
52
55
|
end
|
@@ -76,6 +79,7 @@ module Delayed
|
|
76
79
|
|
77
80
|
def run_process(process_name, dir)
|
78
81
|
Daemons.run_proc(process_name, :dir => dir, :dir_mode => :normal, :monitor => @monitor, :ARGV => @args) do |*args|
|
82
|
+
$0 = File.join(@options[:prefix], process_name) if @options[:prefix]
|
79
83
|
run process_name
|
80
84
|
end
|
81
85
|
end
|
data/lib/delayed/yaml_ext.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# Classes, Modules and Structs
|
3
3
|
|
4
4
|
require 'yaml'
|
5
|
+
YAML::ENGINE.yamler = "syck" if defined?(YAML::ENGINE)
|
5
6
|
|
6
7
|
class Module
|
7
8
|
yaml_as "tag:ruby.yaml.org,2002:module"
|
@@ -27,7 +28,7 @@ end
|
|
27
28
|
|
28
29
|
class Class
|
29
30
|
yaml_as "tag:ruby.yaml.org,2002:class"
|
30
|
-
remove_method :to_yaml # use Module's to_yaml
|
31
|
+
remove_method :to_yaml if respond_to?(:to_yaml) && method(:to_yaml).owner == Class # use Module's to_yaml
|
31
32
|
end
|
32
33
|
|
33
34
|
class Struct
|
data/spec/yaml_ext_spec.rb
CHANGED
@@ -3,14 +3,29 @@ require 'spec_helper'
|
|
3
3
|
describe YAML do
|
4
4
|
it "should autoload classes that are unknown at runtime" do
|
5
5
|
lambda {
|
6
|
-
YAML.load("--- !ruby/object:Autoloaded::Clazz {}")
|
6
|
+
obj = YAML.load("--- !ruby/object:Autoloaded::Clazz {}")
|
7
|
+
obj.class.to_s.should == 'Autoloaded::Clazz'
|
7
8
|
}.should_not raise_error
|
8
9
|
end
|
9
10
|
|
10
11
|
it "should autoload structs that are unknown at runtime" do
|
11
12
|
lambda {
|
12
|
-
YAML.load("--- !ruby/struct:Autoloaded::Struct {}")
|
13
|
+
obj = YAML.load("--- !ruby/struct:Autoloaded::Struct {}")
|
14
|
+
obj.class.to_s.should == 'Autoloaded::Struct'
|
13
15
|
}.should_not raise_error
|
14
16
|
end
|
17
|
+
|
18
|
+
# As we're overriding some of Yaml's internals it is best that our changes
|
19
|
+
# don't impact other places where Yaml is used. Or at least don't make it
|
20
|
+
# look like the exception is caused by DJ
|
21
|
+
it "should not raise exception on poorly formatted yaml" do
|
22
|
+
lambda do
|
23
|
+
YAML.load(<<-EOYAML
|
24
|
+
default:
|
25
|
+
<<: *login
|
26
|
+
EOYAML
|
27
|
+
)
|
28
|
+
end.should_not raise_error
|
29
|
+
end
|
15
30
|
|
16
|
-
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 2.1.
|
9
|
+
- 4
|
10
|
+
version: 2.1.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Chris Gaffney
|
@@ -16,103 +17,110 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2011-
|
20
|
+
date: 2011-02-11 00:00:00 -05:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
24
|
+
prerelease: false
|
25
|
+
type: :runtime
|
23
26
|
name: daemons
|
24
|
-
|
27
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
28
|
none: false
|
26
29
|
requirements:
|
27
30
|
- - ">="
|
28
31
|
- !ruby/object:Gem::Version
|
32
|
+
hash: 3
|
29
33
|
segments:
|
30
34
|
- 0
|
31
35
|
version: "0"
|
32
|
-
|
33
|
-
prerelease: false
|
34
|
-
version_requirements: *id001
|
36
|
+
requirement: *id001
|
35
37
|
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
type: :runtime
|
36
40
|
name: activesupport
|
37
|
-
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
42
|
none: false
|
39
43
|
requirements:
|
40
44
|
- - ~>
|
41
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 7
|
42
47
|
segments:
|
43
48
|
- 3
|
44
49
|
- 0
|
45
50
|
version: "3.0"
|
46
|
-
|
51
|
+
requirement: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
47
53
|
prerelease: false
|
48
|
-
|
54
|
+
type: :development
|
55
|
+
name: rails
|
56
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 7
|
62
|
+
segments:
|
63
|
+
- 3
|
64
|
+
- 0
|
65
|
+
version: "3.0"
|
66
|
+
requirement: *id003
|
49
67
|
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
|
+
type: :development
|
50
70
|
name: rspec
|
51
|
-
|
71
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
52
72
|
none: false
|
53
73
|
requirements:
|
54
74
|
- - ~>
|
55
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
56
77
|
segments:
|
57
78
|
- 2
|
58
79
|
- 0
|
59
80
|
version: "2.0"
|
60
|
-
|
61
|
-
prerelease: false
|
62
|
-
version_requirements: *id003
|
81
|
+
requirement: *id004
|
63
82
|
- !ruby/object:Gem::Dependency
|
83
|
+
prerelease: false
|
84
|
+
type: :development
|
64
85
|
name: rake
|
65
|
-
|
86
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
66
87
|
none: false
|
67
88
|
requirements:
|
68
89
|
- - ">="
|
69
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
70
92
|
segments:
|
71
93
|
- 0
|
72
94
|
version: "0"
|
73
|
-
|
74
|
-
prerelease: false
|
75
|
-
version_requirements: *id004
|
95
|
+
requirement: *id005
|
76
96
|
- !ruby/object:Gem::Dependency
|
77
|
-
name: rails
|
78
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
|
-
requirements:
|
81
|
-
- - ~>
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
segments:
|
84
|
-
- 3
|
85
|
-
- 0
|
86
|
-
version: "3.0"
|
87
|
-
type: :development
|
88
97
|
prerelease: false
|
89
|
-
|
90
|
-
- !ruby/object:Gem::Dependency
|
98
|
+
type: :development
|
91
99
|
name: sqlite3
|
92
|
-
|
100
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
93
101
|
none: false
|
94
102
|
requirements:
|
95
103
|
- - ">="
|
96
104
|
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
97
106
|
segments:
|
98
107
|
- 0
|
99
108
|
version: "0"
|
100
|
-
|
101
|
-
prerelease: false
|
102
|
-
version_requirements: *id006
|
109
|
+
requirement: *id006
|
103
110
|
- !ruby/object:Gem::Dependency
|
111
|
+
prerelease: false
|
112
|
+
type: :development
|
104
113
|
name: mysql
|
105
|
-
|
114
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
106
115
|
none: false
|
107
116
|
requirements:
|
108
117
|
- - ">="
|
109
118
|
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
110
120
|
segments:
|
111
121
|
- 0
|
112
122
|
version: "0"
|
113
|
-
|
114
|
-
prerelease: false
|
115
|
-
version_requirements: *id007
|
123
|
+
requirement: *id007
|
116
124
|
description: |-
|
117
125
|
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.
|
118
126
|
|
@@ -178,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
186
|
requirements:
|
179
187
|
- - ">="
|
180
188
|
- !ruby/object:Gem::Version
|
181
|
-
hash:
|
189
|
+
hash: 3
|
182
190
|
segments:
|
183
191
|
- 0
|
184
192
|
version: "0"
|
@@ -187,14 +195,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
195
|
requirements:
|
188
196
|
- - ">="
|
189
197
|
- !ruby/object:Gem::Version
|
190
|
-
hash:
|
198
|
+
hash: 3
|
191
199
|
segments:
|
192
200
|
- 0
|
193
201
|
version: "0"
|
194
202
|
requirements: []
|
195
203
|
|
196
204
|
rubyforge_project:
|
197
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.5.0
|
198
206
|
signing_key:
|
199
207
|
specification_version: 3
|
200
208
|
summary: Database-backed asynchronous priority queue system -- Extracted from Shopify
|