resque-mods 1.0.1 → 1.0.2
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/Gemfile +1 -0
- data/lib/resque-mods/logged_job.rb +1 -0
- data/lib/resque-mods/version.rb +1 -1
- data/spec/resque-mods/logged_job_spec.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
data/Gemfile
CHANGED
@@ -14,6 +14,7 @@ module ResqueMods
|
|
14
14
|
ResqueMods.logger.info "#{clazz} completed unsuccessfully in #{run_time.round unless run_time.nil?} seconds with #{e.class}:#{e.message}"
|
15
15
|
raise
|
16
16
|
end
|
17
|
+
Librato.measure("resque_mods.logged_job.#{clazz}.run_time", "%f" % run_time)
|
17
18
|
ResqueMods.logger.info "#{clazz} completed successfully in #{run_time.round unless run_time.nil?} seconds"
|
18
19
|
end
|
19
20
|
end
|
data/lib/resque-mods/version.rb
CHANGED
@@ -17,10 +17,26 @@ describe ResqueMods::LoggedJob do
|
|
17
17
|
def do_job
|
18
18
|
Resque::Job.new(:jobs, {'class' => "LoggedDummy", 'args' => [1, 2, 3]}).perform
|
19
19
|
end
|
20
|
+
|
21
|
+
def last_logged
|
22
|
+
Librato.log_reporter.log.rewind
|
23
|
+
Librato.log_reporter.log.readlines[-1].to_s.chomp
|
24
|
+
end
|
25
|
+
|
26
|
+
before do
|
27
|
+
Librato.log_reporter.log = StringIO.new
|
28
|
+
end
|
29
|
+
|
20
30
|
it "should call the nested perform method" do
|
21
31
|
LoggedDummy.should_receive(:perform).with(1, 2, 3)
|
22
32
|
do_job
|
23
33
|
end
|
34
|
+
|
35
|
+
it "should measure the run time with librato-logreporter" do
|
36
|
+
do_job
|
37
|
+
last_logged.should =~ /resque_mods\.logged_job\.LoggedDummy\.run_time=[-+]?([0-9]*\.[0-9]+|[0-9]+)/
|
38
|
+
end
|
39
|
+
|
24
40
|
context "when an error occurs" do
|
25
41
|
it "should not swallow the error" do
|
26
42
|
LoggedDummy.stub(:perform).and_raise(DummyExcepion.new)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A set of extensions for resque jobs
|
15
15
|
email:
|