resque-multi-job-forks 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/test/helper.rb +23 -0
- data/test/test_resque-multi-job-forks.rb +1 -1
- metadata +11 -6
data/test/helper.rb
CHANGED
@@ -9,6 +9,7 @@ Bundler.setup
|
|
9
9
|
Bundler.require
|
10
10
|
require 'test/unit'
|
11
11
|
require 'resque-multi-job-forks'
|
12
|
+
require 'timeout'
|
12
13
|
|
13
14
|
# setup redis & resque.
|
14
15
|
redis = Redis.new(:db => 1)
|
@@ -22,6 +23,28 @@ module Resque
|
|
22
23
|
puts "*** #{msg}" unless ENV['VERBOSE'].nil?
|
23
24
|
end
|
24
25
|
alias_method :log!, :log
|
26
|
+
|
27
|
+
# Processes a given job in the child.
|
28
|
+
def perform_without_multi_job_forks(job)
|
29
|
+
begin
|
30
|
+
# 'will_fork?' returns false in test mode, but since we need to test
|
31
|
+
# if the :after_fork hook runs, we ignore 'will_fork?' here.
|
32
|
+
run_hook :after_fork, job # if will_fork?
|
33
|
+
job.perform
|
34
|
+
rescue Object => e
|
35
|
+
log "#{job.inspect} failed: #{e.inspect}"
|
36
|
+
begin
|
37
|
+
job.fail(e)
|
38
|
+
rescue Object => e
|
39
|
+
log "Received exception when reporting failure: #{e.inspect}"
|
40
|
+
end
|
41
|
+
failed!
|
42
|
+
else
|
43
|
+
log "done: #{job.inspect}"
|
44
|
+
ensure
|
45
|
+
yield job if block_given?
|
46
|
+
end
|
47
|
+
end
|
25
48
|
end
|
26
49
|
end
|
27
50
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-multi-job-forks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: resque
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.22
|
23
|
+
version: '1.22'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ~>
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 1.22
|
31
|
+
version: '1.22'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: json
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,19 +101,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
hash: -2399220530953740688
|
104
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
108
|
none: false
|
106
109
|
requirements:
|
107
110
|
- - ! '>='
|
108
111
|
- !ruby/object:Gem::Version
|
109
112
|
version: '0'
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
hash: -2399220530953740688
|
110
116
|
requirements: []
|
111
117
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.8.
|
118
|
+
rubygems_version: 1.8.23
|
113
119
|
signing_key:
|
114
120
|
specification_version: 3
|
115
121
|
summary: Have your resque workers process more that one job
|
116
122
|
test_files:
|
117
123
|
- test/helper.rb
|
118
124
|
- test/test_resque-multi-job-forks.rb
|
119
|
-
has_rdoc:
|