postgres-vacuum-monitor 0.15.0 → 0.16.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: 7adf2bf1e4f074e47452b50e4e2d15361a863855982fcde8bec82d765f0cb0ed
4
- data.tar.gz: b647585c53690c45b4cd02906781ad19cf74f1fd0b8557cccc683e3b788fac1f
3
+ metadata.gz: 3d9e8b90692a2b1bbadc40202497aae4af9a3e088b8c5a47869396ba5d14e796
4
+ data.tar.gz: 7db2e649f6c350a613e6b765f0cf9fe4f10cae9a4b0aa05f47a585519a029ad3
5
5
  SHA512:
6
- metadata.gz: 17e2c7f1d81da24a710c4ee4343b3bb9310ee4c1faa686d725d69ed5cc10ac6046bc0f362f3f4a4e6ce462f624b93822af16f7bdc55c38a563ae5904470fccb8
7
- data.tar.gz: 3122e2a4088eeb66571a043da2caa1f89fa0f3f41aaa6387cb99dfc7ee64e34287674518ffcdb1b51816baae3c74638ae6cc7f01ae69d6aa8d17694c19849df9
6
+ metadata.gz: 7668c76a3666dfa35a70c26a923b2a9aebd1f0d1d96c3f4f5fe868dcba9c6f2ec4e15edcf1dbba07b17ab460b04d898c3468709e0dfd54532d6b503ca02f63f7
7
+ data.tar.gz: 284047bdc67471afda8abc017e377d3536de6e1593bfcc9993bc8ff16d5be562194b4f552f36ef150259c51b34571fcfc5b6ada56767da6fb2469d48c50aeca0
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @fgarces @will89
1
+ * @salsify/pim-core-backend
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # postgres-vacuum-monitor
2
2
 
3
+ ## v0.16.0
4
+ - Add `max_attempts` and `max_run_time` to `Postgres::Vacuum::Jobs::MonitorJob` to avoid backing up the queue. The
5
+ defaults are 1 attempt and 10 seconds, but they can be configured with `monitor_max_attempts` and
6
+ `monitor_max_run_time_seconds`, respectively.
7
+
3
8
  ## v0.15.0
4
9
  - Add support for Rails 7.1
5
10
 
data/README.md CHANGED
@@ -34,7 +34,11 @@ The job itself needs a class to report the information and can be configured by
34
34
  Postgres::Vacuum::Monitor.configure do |config|
35
35
  config.monitor_reporter_class_name = 'MetricsReporter'
36
36
  # Optionally change the default threshold of 5 minutes for reporting long running transactions
37
- config.long_running_transaction_threshold_seconds = 10 * 60
37
+ config.long_running_transaction_threshold_seconds = 10 * 60
38
+ # Optionally change `max_attempts` of the monitor job (default 1)
39
+ config.monitor_max_attempts = 3
40
+ # Optionally change `max_run_time` of the monitor job (default 10 seconds)
41
+ config.monitor_max_run_time_seconds = 5
38
42
  end
39
43
  ```
40
44
 
@@ -4,11 +4,19 @@ module Postgres
4
4
  module Vacuum
5
5
  class Configuration
6
6
  DEFAULT_LONG_RUNNING_TRANSACTION_THRESHOLD_SECONDS = 5 * 60
7
- attr_accessor :monitor_reporter_class_name, :long_running_transaction_threshold_seconds
7
+ DEFAULT_MONITOR_MAX_RUN_TIME_SECONDS = 10
8
+ DEFAULT_MONITOR_MAX_ATTEMPTS = 1
9
+
10
+ attr_accessor :monitor_reporter_class_name,
11
+ :long_running_transaction_threshold_seconds,
12
+ :monitor_max_run_time_seconds,
13
+ :monitor_max_attempts
8
14
 
9
15
  def initialize
10
16
  self.monitor_reporter_class_name = nil
11
17
  self.long_running_transaction_threshold_seconds = DEFAULT_LONG_RUNNING_TRANSACTION_THRESHOLD_SECONDS
18
+ self.monitor_max_run_time_seconds = DEFAULT_MONITOR_MAX_RUN_TIME_SECONDS
19
+ self.monitor_max_attempts = DEFAULT_MONITOR_MAX_ATTEMPTS
12
20
  end
13
21
  end
14
22
  end
@@ -11,6 +11,14 @@ module Postgres
11
11
  CONNECTION_STATE = 'ConnectionState'
12
12
  CONNECTION_IDLE_TIME = 'ConnectionIdleTime'
13
13
 
14
+ def max_run_time
15
+ Postgres::Vacuum::Monitor.configuration.monitor_max_run_time_seconds.seconds
16
+ end
17
+
18
+ def max_attempts
19
+ Postgres::Vacuum::Monitor.configuration.monitor_max_attempts
20
+ end
21
+
14
22
  def perform(*)
15
23
  with_each_db_name_and_connection do |name, connection|
16
24
  connection.execute(Postgres::Vacuum::Monitor::Query.long_running_transactions).each do |row|
@@ -3,7 +3,7 @@
3
3
  module Postgres
4
4
  module Vacuum
5
5
  module Monitor
6
- VERSION = '0.15.0'
6
+ VERSION = '0.16.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgres-vacuum-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Garces
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal