health-monitor-rails 11.3.0 → 12.1.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: ef2ab1a402fc161f4abe3c76733649ff053e3edeeb74143d97ff25e2431bda5e
4
- data.tar.gz: 4f49b79333e4e13e804e9219a2a9391833bc985b0ebed37d96887b527a3cb25e
3
+ metadata.gz: 5a4b35be2c84bd3859456f041a978da8828cb72294d86bfab7b97dc3478134b3
4
+ data.tar.gz: a393dbc7c46777aae939589d443b67ef41abbeb238879adf4ff6985511aceda9
5
5
  SHA512:
6
- metadata.gz: dd7b07152e96cf14cbf56ebaf66b9b4a0f018d2913f5f0ae72715b9b8758a4c674ab1c1eb5ffdd74128bf6d0323454dab39a63b16f2d6b089a80e872cbecd89c
7
- data.tar.gz: e5966d745ac421b1da9a3b65695bd668e34c391f26ad5d4e40a2a1e31372cb48667412d256f2bf4883ecafceec68653f44faa76d0ff93ef32b343a9a6213d597
6
+ metadata.gz: 1f18d57cdf6471cf63e7ad493b4019bf1a5edfca635393aa1f35def68439dfd859b19ccf2fb3f5ab178015db46b24bf7507ed43fbc8efc8114e44d7d7e8ff736
7
+ data.tar.gz: 4da774036fbbf7e4baf0e6abb2bd7eb313282bc2ea3ca39feded6bfe0c099f2fe5549e02b799e255d9d4738d07bf80ecda5dfd2b10caa213f3f68170204d684d
data/README.md CHANGED
@@ -332,7 +332,7 @@ end
332
332
 
333
333
  ```ruby
334
334
  HealthMonitor.configure do |config|
335
- config.add_custom_provider(CustomProvider.new)
335
+ config.add_custom_provider(CustomProvider)
336
336
  end
337
337
  ```
338
338
 
@@ -11,7 +11,7 @@ module HealthMonitor
11
11
  failed_databases = []
12
12
 
13
13
  ActiveRecord::Base.connection_handler.connection_pool_list(:all).each do |cp|
14
- cp.connection.check_version
14
+ cp.connection.execute('SELECT 1')
15
15
  rescue Exception
16
16
  failed_databases << cp.db_config.name
17
17
  end
@@ -14,11 +14,14 @@ module HealthMonitor
14
14
  DEFAULT_QUEUES_SIZE = 100
15
15
  DEFAULT_RETRY_CHECK = 20
16
16
 
17
+ attr_accessor :maximum_amount_of_retries
17
18
  attr_reader :queues
18
19
 
19
20
  def initialize(provider)
20
21
  super(provider)
21
22
 
23
+ @maximum_amount_of_retries = DEFAULT_RETRY_CHECK
24
+
22
25
  @queues = {}
23
26
  @queues[DEFAULT_QUEUE_NAME] = { latency: DEFAULT_LATENCY_TIMEOUT, queue_size: DEFAULT_QUEUES_SIZE }
24
27
  end
@@ -96,10 +99,13 @@ module HealthMonitor
96
99
  end
97
100
 
98
101
  def check_amount_of_retries!
99
- maximum_amount_of_retries = ::HealthMonitor::Providers::Sidekiq::Configuration::DEFAULT_RETRY_CHECK
100
- jobs_over_limit = ::Sidekiq::RetrySet.new.select { |job| job.item['retry_count'] >= maximum_amount_of_retries }
102
+ jobs_over_limit = ::Sidekiq::RetrySet.new.select do |job|
103
+ job.item['retry_count'] >= configuration.maximum_amount_of_retries
104
+ end
105
+
106
+ return unless jobs_over_limit.any?
101
107
 
102
- raise "amount of retries for a job is greater than #{maximum_amount_of_retries}" if jobs_over_limit.any?
108
+ raise "amount of retries for a job is greater than #{configuration.maximum_amount_of_retries}"
103
109
  end
104
110
 
105
111
  def check_redis!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HealthMonitor
4
- VERSION = '11.3.0'
4
+ VERSION = '12.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health-monitor-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.3.0
4
+ version: 12.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Beder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-21 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties