resque-forker 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +8 -0
- data/lib/resque/forker/version.rb +1 -1
- data/lib/resque/master.rb +23 -12
- metadata +5 -5
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
2011-02-07 v2.1.0 No arguments necessary for resque-ctl
|
2
|
+
|
3
|
+
Added some sane defaults to allow the command to run without command line
|
4
|
+
arguments. For example, in a rails application development is easy (taf2):
|
5
|
+
|
6
|
+
$ bundle exec resque-ctl
|
7
|
+
|
8
|
+
|
1
9
|
2011-02-02 v2.0 Now, with resque-ctl
|
2
10
|
|
3
11
|
You can now run workers from the command line
|
data/lib/resque/master.rb
CHANGED
@@ -64,7 +64,7 @@ module Resque
|
|
64
64
|
|
65
65
|
def initialize(path)
|
66
66
|
@config_path = path
|
67
|
-
@options =
|
67
|
+
@options = Master.defaults
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.process(config_path)
|
@@ -74,27 +74,35 @@ module Resque
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def run
|
77
|
-
|
77
|
+
self.instance_eval(File.read(@config_path), @config_path, 0)
|
78
|
+
rescue => e
|
79
|
+
raise "Config error: '#{e.message}' at #{e.backtrace[0].gsub(/:in `run'/,'')}"
|
78
80
|
end
|
79
81
|
|
80
82
|
def self.setup(options)
|
81
|
-
|
83
|
+
options[:runpath] = Dir.pwd if options[:runpath].nil?
|
82
84
|
|
83
85
|
Resque.setup do |forker|
|
84
|
-
puts "calling resque setup: #{options.inspect}"
|
85
86
|
if options[:preload_app]
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
begin
|
88
|
+
$:.unshift options[:runpath] # Makes 1.9.2 happy
|
89
|
+
require options[:runpath] + "/config/environment"
|
90
|
+
puts "Loaded Rails: #{Rails.env}"
|
91
|
+
forker.logger = Rails.logger
|
92
|
+
rescue => e
|
93
|
+
STDERR.puts e.message
|
94
|
+
STDERR.puts e.backtrace.join("\n")
|
95
|
+
raise e
|
96
|
+
end
|
89
97
|
end
|
90
98
|
|
91
|
-
File.open(options[:pidfile],"wb") {|f| f << Process.pid }
|
92
|
-
forker.workload = options[:worker_queues] * options[:worker_processes].to_i
|
99
|
+
File.open(options[:pidfile],"wb") {|f| f << Process.pid } if options[:pidfile]
|
100
|
+
forker.workload = options[:worker_queues] * options[:worker_processes].to_i if options[:worker_queues] && options[:worker_processes]
|
93
101
|
forker.options.interval = options[:work_interval].to_i if options.key?(:work_interval)
|
94
102
|
end
|
95
103
|
|
96
104
|
Resque.teardown do|forker|
|
97
|
-
File.unlink(options[:pidfile]) if File.exist?(options[:pidfile])
|
105
|
+
File.unlink(options[:pidfile]) if options[:pidfile] && File.exist?(options[:pidfile])
|
98
106
|
end
|
99
107
|
|
100
108
|
Resque.before_first_fork do
|
@@ -212,9 +220,12 @@ module Resque
|
|
212
220
|
:logfile => nil,
|
213
221
|
:stderr_path => "/dev/null",
|
214
222
|
:stdout_path => "/dev/null",
|
215
|
-
:runpath => "/",
|
216
223
|
:pidfile => nil,
|
217
|
-
:daemon => false
|
224
|
+
:daemon => false,
|
225
|
+
:preload_app => true,
|
226
|
+
:worker_queues => ['*'],
|
227
|
+
:worker_processes => 1,
|
228
|
+
:work_interval => 5
|
218
229
|
}
|
219
230
|
end
|
220
231
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-forker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Assaf Arkin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-08 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -62,7 +62,7 @@ licenses: []
|
|
62
62
|
post_install_message: ""
|
63
63
|
rdoc_options:
|
64
64
|
- --title
|
65
|
-
- Resque Forker 2.
|
65
|
+
- Resque Forker 2.1.0
|
66
66
|
- --main
|
67
67
|
- README.rdoc
|
68
68
|
- --webcvs
|