delayed_job 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -4
- data/VERSION +1 -1
- data/contrib/delayed_job.monitrc +3 -3
- data/delayed_job.gemspec +3 -3
- data/lib/delayed/command.rb +15 -4
- metadata +3 -3
data/README.textile
CHANGED
@@ -83,12 +83,12 @@ h2. Running Jobs
|
|
83
83
|
@script/delayed_job@ can be used to manage a background process which will start working off jobs.
|
84
84
|
|
85
85
|
<pre>
|
86
|
-
$
|
87
|
-
$
|
86
|
+
$ RAILS_ENV=production script/delayed_job start
|
87
|
+
$ RAILS_ENV=production script/delayed_job stop
|
88
88
|
|
89
89
|
# Runs two workers in separate processes.
|
90
|
-
$
|
91
|
-
$
|
90
|
+
$ RAILS_ENV=production script/delayed_job -n 2 start
|
91
|
+
$ RAILS_ENV=production script/delayed_job stop
|
92
92
|
</pre>
|
93
93
|
|
94
94
|
Workers can be running on any computer, as long as they have access to the database and their clock is in sync. Keep in mind that each worker will check the database at least every 5 seconds.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.3
|
data/contrib/delayed_job.monitrc
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
#
|
4
4
|
# To use:
|
5
5
|
# 1. copy to /var/www/apps/{app_name}/shared/delayed_job.monitrc
|
6
|
-
# 2. replace {app_name}
|
6
|
+
# 2. replace {app_name} as appropriate
|
7
7
|
# 3. add this to your /etc/monit/monitrc
|
8
8
|
#
|
9
9
|
# include /var/www/apps/{app_name}/shared/delayed_job.monitrc
|
10
10
|
|
11
11
|
check process delayed_job
|
12
12
|
with pidfile /var/www/apps/{app_name}/shared/pids/delayed_job.pid
|
13
|
-
start program = "/var/www/apps/{app_name}/current/script/delayed_job
|
14
|
-
stop program = "/var/www/apps/{app_name}/current/script/delayed_job
|
13
|
+
start program = "RAILS_ENV=production /var/www/apps/{app_name}/current/script/delayed_job start"
|
14
|
+
stop program = "RAILS_ENV=production /var/www/apps/{app_name}/current/script/delayed_job stop"
|
data/delayed_job.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{delayed_job}
|
8
|
-
s.version = "1.8.
|
8
|
+
s.version = "1.8.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brandon Keepers", "Tobias L\303\274tke"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-28}
|
13
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
14
|
s.email = %q{tobi@leetsoft.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
s.homepage = %q{http://github.com/collectiveidea/delayed_job}
|
46
46
|
s.rdoc_options = ["--main", "README.textile", "--inline-source", "--line-numbers"]
|
47
47
|
s.require_paths = ["lib"]
|
48
|
-
s.rubygems_version = %q{1.3.
|
48
|
+
s.rubygems_version = %q{1.3.5}
|
49
49
|
s.summary = %q{Database-backed asynchronous priority queue system -- Extracted from Shopify}
|
50
50
|
s.test_files = [
|
51
51
|
"spec/database.rb",
|
data/lib/delayed/command.rb
CHANGED
@@ -7,7 +7,9 @@ module Delayed
|
|
7
7
|
attr_accessor :worker_count
|
8
8
|
|
9
9
|
def initialize(args)
|
10
|
+
@files_to_reopen = []
|
10
11
|
@options = {:quiet => true}
|
12
|
+
|
11
13
|
@worker_count = 1
|
12
14
|
|
13
15
|
opts = OptionParser.new do |opts|
|
@@ -18,7 +20,7 @@ module Delayed
|
|
18
20
|
exit 1
|
19
21
|
end
|
20
22
|
opts.on('-e', '--environment=NAME', 'Specifies the environment to run this delayed jobs under (test/development/production).') do |e|
|
21
|
-
|
23
|
+
STDERR.puts "The -e/--environment option has been deprecated and has no effect. Use RAILS_ENV and see http://github.com/collectiveidea/delayed_job/issues/#issue/7"
|
22
24
|
end
|
23
25
|
opts.on('--min-priority N', 'Minimum priority of jobs to run.') do |n|
|
24
26
|
@options[:min_priority] = n
|
@@ -34,6 +36,10 @@ module Delayed
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def daemonize
|
39
|
+
ObjectSpace.each_object(File) do |file|
|
40
|
+
@files_to_reopen << file unless file.closed?
|
41
|
+
end
|
42
|
+
|
37
43
|
worker_count.times do |worker_index|
|
38
44
|
process_name = worker_count == 1 ? "delayed_job" : "delayed_job.#{worker_index}"
|
39
45
|
Daemons.run_proc(process_name, :dir => "#{RAILS_ROOT}/tmp/pids", :dir_mode => :normal, :ARGV => @args) do |*args|
|
@@ -45,10 +51,15 @@ module Delayed
|
|
45
51
|
def run(worker_name = nil)
|
46
52
|
Dir.chdir(RAILS_ROOT)
|
47
53
|
|
48
|
-
#
|
49
|
-
|
50
|
-
|
54
|
+
# Re-open file handles
|
55
|
+
@files_to_reopen.each do |file|
|
56
|
+
begin
|
57
|
+
file.reopen File.join(RAILS_ROOT, 'log', 'delayed_job.log'), 'w+'
|
58
|
+
file.sync = true
|
59
|
+
rescue ::Exception
|
60
|
+
end
|
51
61
|
end
|
62
|
+
|
52
63
|
Delayed::Worker.logger = Rails.logger
|
53
64
|
ActiveRecord::Base.connection.reconnect!
|
54
65
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Keepers
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-09-
|
13
|
+
date: 2009-09-28 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
requirements: []
|
76
76
|
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
78
|
+
rubygems_version: 1.3.5
|
79
79
|
signing_key:
|
80
80
|
specification_version: 3
|
81
81
|
summary: Database-backed asynchronous priority queue system -- Extracted from Shopify
|