sidekiq-cronitor 3.4.0 → 3.6.0

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
  SHA256:
3
- metadata.gz: ebea71b4352db386aa8712eb8462b88b4f2a91ed0e7921face88453eb56981e7
4
- data.tar.gz: 74fd0296d97a9480d55442d777937c6ae21f6a0821b6c690c8f9d366432ad998
3
+ metadata.gz: d6373d1623a7c00d0e260437399f5ec1574db09700d9e212e1a51960a5efdbca
4
+ data.tar.gz: 6843e645b9cbd23edf564d8b95af27d8a7deea2247bb451b08ed862d018e0e63
5
5
  SHA512:
6
- metadata.gz: 699883656bff1c2adc7e08fcbae41006e4be244a256ffebe30b54b891b51dde4367f412ca4616b6a35571b0c2c892ee4f207696fa42575eb276e203295869260
7
- data.tar.gz: 1edd11e88318b33b950626aae9b7615e0e5bf007ae74bc0e5a68582979f9d6741c5120b9ea4551fd1a3a675890a43d56ca69fa857be3a54b7dd9c9a5b0836677
6
+ metadata.gz: c45f495adaa7f83d80db7da49c7ae8d89b6999a6259653543de2a57dd543751f09f8c6d5ec2002df143db86ebad3732d3d60c2ea85a7739be2205fff6ec9c2e1
7
+ data.tar.gz: 2dd6b470ee157a2ee44a7207138623e5b43e39a3f7d7454aa6c0d8dcfa89cd4741d80b4aecad8d04e7586f5ae573775992d67afb70e5fa4dd5a0fa7e044adaec
@@ -6,15 +6,28 @@ module Sidekiq::Cronitor
6
6
  monitors_payload = []
7
7
  loops = Sidekiq::Periodic::LoopSet.new
8
8
  loops.each do |lop|
9
- job_key = lop.klass.sidekiq_options.fetch('cronitor_key', lop.klass.to_s)
10
- next if lop.klass.sidekiq_options.fetch('cronitor_disabled', false)
9
+ next if fetch_option(lop, 'cronitor_disabled')
11
10
 
12
- monitors_payload << { key: job_key, schedule: lop.schedule, metadata: lop.options, platform: 'sidekiq', type: 'job' }
11
+ monitors_payload << {
12
+ key: fetch_option(lop, 'cronitor_key') || lop.klass.to_s,
13
+ group: fetch_option(lop, 'cronitor_group'),
14
+ grace_seconds: fetch_option(lop, 'cronitor_grace_seconds')&.to_i,
15
+ schedule: lop.schedule,
16
+ timezone: lop.tz_name || Time.respond_to?(:zone) && Time.zone.tzinfo.name || nil,
17
+ metadata: lop.options.to_s,
18
+ platform: 'sidekiq',
19
+ type: 'job'
20
+ }.compact
13
21
  end
14
22
 
15
23
  Cronitor::Monitor.put(monitors: monitors_payload)
16
24
  rescue Cronitor::Error => e
17
25
  Sidekiq.logger.error("[cronitor] error during #{name}.#{__method__}: #{e}")
18
26
  end
27
+
28
+ def self.fetch_option(lop, key)
29
+ lop.options.fetch(key, nil) ||
30
+ lop.klass.constantize.sidekiq_options.fetch(key, nil)
31
+ end
19
32
  end
20
33
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Cronitor
3
- VERSION = '3.4.0'
3
+ VERSION = '3.6.0'
4
4
  end
5
5
  end
@@ -41,8 +41,18 @@ module Sidekiq::Cronitor
41
41
  end
42
42
 
43
43
  def job_key(worker)
44
- worker.class.sidekiq_options.fetch("cronitor_key", nil) ||
45
- options(worker).fetch(:key, worker.class.name)
44
+ periodic_job_key(worker) || worker.class.sidekiq_options.fetch('cronitor_key', nil) ||
45
+ options(worker).fetch(:key, worker.class.name)
46
+ end
47
+
48
+ def periodic_job_key(worker)
49
+ return unless defined?(Sidekiq::Periodic)
50
+
51
+ periodic_job = Sidekiq::Periodic::LoopSet.new.find do |lop|
52
+ lop.history.find { |j| j[0] == worker.jid }
53
+ end
54
+
55
+ periodic_job.present? && periodic_job.options.fetch('cronitor_key', nil)
46
56
  end
47
57
 
48
58
  def options(worker)
metadata CHANGED
@@ -1,30 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cronitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeke Gabrielse
8
8
  - Samuel Cochran
9
+ - Kevin Tom
10
+ - August Flanagan
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2022-08-20 00:00:00.000000000 Z
14
+ date: 2023-02-01 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: sidekiq
16
18
  requirement: !ruby/object:Gem::Requirement
17
19
  requirements:
18
- - - "~>"
20
+ - - "<"
19
21
  - !ruby/object:Gem::Version
20
- version: '6.0'
22
+ version: '8'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
24
26
  requirements:
25
- - - "~>"
27
+ - - "<"
26
28
  - !ruby/object:Gem::Version
27
- version: '6.0'
29
+ version: '8'
28
30
  - !ruby/object:Gem::Dependency
29
31
  name: cronitor
30
32
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +102,8 @@ description: Integrates Sidekiq with Cronitor so that workers send lifecycle eve
100
102
  email:
101
103
  - zeke@keygen.sh
102
104
  - sj26@sj26.com
105
+ - kevin.tom@gmail.com
106
+ - august@cronitor.io
103
107
  executables: []
104
108
  extensions: []
105
109
  extra_rdoc_files: []