good_job 3.4.0 → 3.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73efcb35d2a5e0ccfd13e2526a9a9d4a7195c4bf2e4a7f4127894a68c7f5dbb9
4
- data.tar.gz: d9fddab346e5851e23daa5d9bef8c68b1fd5472f37d687c3cb49c5ff551cc31c
3
+ metadata.gz: 38942c9c17765023398fe2a5c2f3dc2c0ebadc799858ed1102bc47bd11d70ed9
4
+ data.tar.gz: 1dbbff4895a344d948592ec8801e1a325f48b984b66738efdbf785ca4f46f9b6
5
5
  SHA512:
6
- metadata.gz: d720ab703536db9dfd396097aeb8b3aae64f5cd55a1754a9965eaaca275a2babfc4a05d249fb13896d776d02034553bd81cdda8b0af19a6f49d9a3a4bca29045
7
- data.tar.gz: 9dd2af1f00637c3db171934777cc02be231e3ee98ad953aa9fcf030b00faa9fdd2b811f6e69094120a2deee8415e6a33d2d2a4a4d7701fbf89f7c45e272658ef
6
+ metadata.gz: 03ac67ff433d1124b3d1dfcb07fb61d9b47393d4dcc8f3341698d5eead8597611009f453ea7cdc09f12cab2b1fbd1a6ed04fcb14fbe532aed8d0ac9fdb9c33f0
7
+ data.tar.gz: 0d951f8f156fbc47df60271d8f845df9ee93980af9ce3153a81fb8e3c7c0b4f80cbe7f727189be7d06930b97e30b89c65bf7d15fbe39138044979c8c4b319c8d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.4.1](https://github.com/bensheldon/good_job/tree/v3.4.1) (2022-08-06)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.0...v3.4.1)
6
+
7
+ **Closed issues:**
8
+
9
+ - Add `cron_enabled` to Process state [\#673](https://github.com/bensheldon/good_job/issues/673)
10
+ - Good job is using a lot of memory / ram [\#613](https://github.com/bensheldon/good_job/issues/613)
11
+ - ActiveRecord::StatementInvalid: PG::ConnectionBad: PQsocket\(\) can't get socket descriptor every 30 minutes aprox. [\#579](https://github.com/bensheldon/good_job/issues/579)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Only report Notifier connection errors once after they happen 3 consecutive times [\#689](https://github.com/bensheldon/good_job/pull/689) ([bensheldon](https://github.com/bensheldon))
16
+
3
17
  ## [v3.4.0](https://github.com/bensheldon/good_job/tree/v3.4.0) (2022-08-05)
4
18
 
5
19
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.3.3...v3.4.0)
@@ -40,6 +40,7 @@ module GoodJob # :nodoc:
40
40
  PG::UnableToSend
41
41
  PG::Error
42
42
  ].freeze
43
+ CONNECTION_ERRORS_REPORTING_THRESHOLD = 3
43
44
 
44
45
  # @!attribute [r] instances
45
46
  # @!scope class
@@ -70,6 +71,8 @@ module GoodJob # :nodoc:
70
71
  def initialize(*recipients)
71
72
  @recipients = Concurrent::Array.new(recipients)
72
73
  @listening = Concurrent::AtomicBoolean.new(false)
74
+ @connection_errors_count = Concurrent::AtomicFixnum.new(0)
75
+ @connection_errors_reported = Concurrent::AtomicBoolean.new(false)
73
76
 
74
77
  self.class.instances << self
75
78
 
@@ -128,7 +131,6 @@ module GoodJob # :nodoc:
128
131
  # @return [void]
129
132
  def listen_observer(_time, _result, thread_error)
130
133
  if thread_error
131
- GoodJob._on_thread_error(thread_error)
132
134
  ActiveSupport::Notifications.instrument("notifier_notify_error.good_job", { error: thread_error })
133
135
 
134
136
  connection_error = CONNECTION_ERRORS.any? do |error_string|
@@ -137,6 +139,16 @@ module GoodJob # :nodoc:
137
139
 
138
140
  thread_error.is_a? error_class
139
141
  end
142
+
143
+ if connection_error
144
+ @connection_errors_count.increment
145
+ if @connection_errors_reported.false? && @connection_errors_count.value >= CONNECTION_ERRORS_REPORTING_THRESHOLD
146
+ GoodJob._on_thread_error(thread_error)
147
+ @connection_errors_reported.make_true
148
+ end
149
+ else
150
+ GoodJob._on_thread_error(thread_error)
151
+ end
140
152
  end
141
153
 
142
154
  return if shutdown?
@@ -175,6 +187,8 @@ module GoodJob # :nodoc:
175
187
  target.send(method_name, parsed_payload)
176
188
  end
177
189
  end
190
+
191
+ reset_connection_errors
178
192
  end
179
193
  end
180
194
  end
@@ -223,5 +237,10 @@ module GoodJob # :nodoc:
223
237
  sleep WAIT_INTERVAL
224
238
  end
225
239
  end
240
+
241
+ def reset_connection_errors
242
+ @connection_errors_count.value = 0
243
+ @connection_errors_reported.make_false
244
+ end
226
245
  end
227
246
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.4.0'
4
+ VERSION = '3.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-05 00:00:00.000000000 Z
11
+ date: 2022-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob