rabbit_jobs 0.8.17 → 0.8.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 152a9a5a412e311f7d72e8fa4cf15efda5f6cd3d
4
- data.tar.gz: 21a5b8aff6143b8c261216b4a29a0637aecd9e99
3
+ metadata.gz: 3d5ca99e16512c61f2efa193f64312952483e7c1
4
+ data.tar.gz: 2f15f4ce6e91d24ff4697766c4ca964dbac0b10d
5
5
  SHA512:
6
- metadata.gz: 717cd68bc341aeba330938616699c98dc72f4af4704898a2e4995fb0d9bed0cb48f34474f78d19ae104d32f92e917bab21f005232b1db8285d163d5abb08382d
7
- data.tar.gz: 468ef3ec40cf4a2b4b6be6715f1e44b55c0292161e9a1aaccf8e47f6a71546e2d5414d4c78101aa5adfa63f7cd19246ac037752174443612d60293a960cdb2f2
6
+ metadata.gz: f17ed6f485e1d30333f119810b4f002c0d17729dff04463db73505a6718191db5e88b9b85c7dd3beb72dea73d5683a75bef080ca24da7450c254c575aca57530
7
+ data.tar.gz: def105487f4cf08d99da3716a59765c424694c39fae62a8c86bb48968e1ff31a1a8e45a89618fbbaacecce66edd166ead2f4d4ddde427623ce2c30cf6ba19fa5
@@ -23,7 +23,7 @@ module RabbitJobs
23
23
  subject, text = build_error_message(job, error)
24
24
  send_letter(subject, text)
25
25
  rescue
26
- RabbitJobs.logger.error [$!.message, $!.backtrace].flatten.join("\n")
26
+ RabbitJobs.logger.error $!
27
27
  end
28
28
  end
29
29
 
@@ -1,4 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
+ require 'benchmark'
3
+
2
4
  module RabbitJobs
3
5
  module Job
4
6
  include RabbitJobs::Helpers
@@ -16,11 +18,9 @@ module RabbitJobs
16
18
 
17
19
  def run_perform
18
20
  begin
19
- start_time = Time.now
20
- RabbitJobs.logger.info "Started to perform #{self.to_ruby_string}"
21
- perform(*params)
22
- execution_time = Time.now - start_time
23
- RabbitJobs.logger.info " Job completed #{self.to_ruby_string} in #{execution_time} seconds."
21
+ ret = nil
22
+ execution_time = Benchmark.measure { ret = perform(*params) }
23
+ RabbitJobs.logger.info short_message: "Job processed [ok]", _job: self.to_ruby_string, _execution_time: execution_time.to_s.strip
24
24
  rescue
25
25
  log_job_error($!)
26
26
  run_on_error_hooks($!)
@@ -95,9 +95,9 @@ module RabbitJobs
95
95
  end
96
96
 
97
97
  def log_job_error(error)
98
- RabbitJobs.logger.warn error.message
99
- RabbitJobs.logger.warn(self.to_ruby_string)
100
- RabbitJobs.logger.warn _cleanup_backtrace(error.backtrace).join("\n")
98
+ RabbitJobs.logger.error(short_message: "Job processed [error]",
99
+ _job: self.to_ruby_string, full_message: _cleanup_backtrace(error.backtrace).join("\r\n"))
100
+
101
101
  Airbrake.notify(error, session: {args: self.to_ruby_string}) if defined?(Airbrake)
102
102
  RabbitJobs::ErrorMailer.report_error(self, error) rescue nil
103
103
  end
@@ -28,8 +28,7 @@ module RabbitJobs
28
28
  raise "Disconnected from #{RJ.config.server}. Connection status: #{connection.try(:status).inspect}"
29
29
  end
30
30
  rescue
31
- RabbitJobs.logger.warn $!.message
32
- RabbitJobs.logger.warn $!.backtrace.join("\n")
31
+ RabbitJobs.logger.error $!.message
33
32
  raise $!
34
33
  end
35
34
 
@@ -52,7 +52,7 @@ module RabbitJobs
52
52
  RabbitJobs.publish_to(config[:queue], klass_name, *params)
53
53
  rescue
54
54
  RabbitJobs.logger.warn "Failed to publish #{klass_name}:\n #{$!}\n params = #{params.inspect}"
55
- RabbitJobs.logger.warn $!.inspect
55
+ RabbitJobs.logger.error $!
56
56
  end
57
57
 
58
58
  def rufus_scheduler
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module RabbitJobs
4
- VERSION = "0.8.17"
4
+ VERSION = "0.8.18"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.17
4
+ version: 0.8.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lazureykis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-07 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny