delayed-plugins-reporting 0.9.0 → 0.9.1

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: 82b5554cc8efd43c1b3e7d3c5b2fbbcc20d81b7b
4
- data.tar.gz: 2626a29c9cd6e91814011b3f11a56dd30fcb0636
3
+ metadata.gz: dd1095a9e58b3ed73f064dd9e5cfebae9d0249ea
4
+ data.tar.gz: 35943fc24de7b6bb78d5a13723c716b2cad86ac6
5
5
  SHA512:
6
- metadata.gz: 31bce618f7613ba8f8ed3b11169aff960d9e3b87575c301b018d433a2d7feec3ea86305c88c1f8f9d60be241fc5897d8878a9d7109cf92944675e1e959bb83ec
7
- data.tar.gz: 08bd37d91f865fc6c29a42de2a0b8bb8aea68da3116a0c860c228741bd37ac5881ebfc3c4fed7b3fd47c5187a6ded3a8782f71feebd1afeeba5c620516331987
6
+ metadata.gz: a5d7689b83a82771c05dd51934701cf745d0d9f05db0cd396bfb284d7d60954c39fc32162f691a18e0293fc42026e31d29bb289e4895268cd597f511455b15bb
7
+ data.tar.gz: d467975726223ff169330754da8d7ebb9c9452cbe18f786891b4d522417e120221553e0a41f3785b1dfb4d2cf098eea357e1ae2e4ed685420072465706ea82fa
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Delayed::Plugins::Reporting
2
2
 
3
+ [![Code Climate](https://codeclimate.com/github/crowdworks/delayed-plugins-reporting/badges/gpa.svg)](https://codeclimate.com/github/crowdworks/delayed-plugins-reporting)
4
+
3
5
  A [Delayed::Job](https://github.com/collectiveidea/delayed_job) plugin to report lifecycle events like job invocations,
4
6
  failures, retries to log files or monitoring services like Datadog.
5
7
 
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
+ spec.add_dependency('delayed_job')
21
+
20
22
  spec.add_development_dependency "bundler", "~> 1.7"
21
23
  spec.add_development_dependency "rake", "~> 10.0"
22
24
  end
@@ -10,6 +10,10 @@ class Delayed::Plugins::Reporting < ::Delayed::Plugin
10
10
  lifecycle.after(:failure) do |worker, job|
11
11
  context.after_failure(worker, job)
12
12
  end
13
+
14
+ lifecycle.before(:perform) do |worker, job|
15
+ context.before_perform(worker, job)
16
+ end
13
17
  end
14
18
  end
15
19
 
@@ -17,6 +17,11 @@ class Delayed::Plugins::Reporting
17
17
  end
18
18
  end
19
19
 
20
+ def before_perform(worker, job)
21
+ return if job.attempts.zero?
22
+ listener.job_retried(job)
23
+ end
24
+
20
25
  class << self
21
26
  def create(reporter: {}, formatter: {}, listener: {})
22
27
  formatter_options = formatter.dup
@@ -10,6 +10,12 @@ class Delayed::Plugins::Reporting
10
10
  EOS
11
11
  end
12
12
 
13
+ def job_retried(job)
14
+ report.error :job_retried, job: job, message: <<-EOS.gsub!(/^\s+/, '')
15
+ The job retried.
16
+ EOS
17
+ end
18
+
13
19
  private
14
20
 
15
21
  def report
@@ -1,5 +1,7 @@
1
- require 'delayed-plugins-reporting'
2
-
3
- class Delayed::Plugins::Reporting
4
- VERSION = '0.9.0'
1
+ module Delayed
2
+ module Plugins
3
+ class Reporting
4
+ VERSION = '0.9.1'
5
+ end
6
+ end
5
7
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed-plugins-reporting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke KUOKA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: delayed_job
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -83,4 +97,3 @@ specification_version: 4
83
97
  summary: A Delayed::Job plugin to report lifecycle events to log files or monitoring
84
98
  services, etc.
85
99
  test_files: []
86
- has_rdoc: