pg-locks-monitor 0.3.1 → 0.3.2

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: 609f63093dd3729e2b05577d39d55d13a09cfeb78dadc185e3cd1bbeff15a5eb
4
- data.tar.gz: 29bb4e5292296c81338ac5250efbc8e85927cdb8ede8354f0e4300b96bca7528
3
+ metadata.gz: 3c123754d01da5acc5a517511066987515ec3167c0063a59c67b272ba0fd39ac
4
+ data.tar.gz: c85d88f96b9593ebb04a849e6cc79958a3040eb119980d17585cb69fdea1733b
5
5
  SHA512:
6
- metadata.gz: 50377aa6446f17e900a28d427a0c6fc734ab78e29934f73af50d7957d3f81228515abb236964c1b6d5e866c5fad001eda0853f13d5aeb0a3cb540d70c7cd0011
7
- data.tar.gz: 782c10cf04da3cbf8ec325cb15680f90bbea646344df1e5e1a1e72125781279f98321f1cce41c6c5d7da60dd59cfaa04a04eadff3233ebe0a282202808fd308e
6
+ metadata.gz: b1f98b1c258f99a3943e178d81f370b664be38b1841edb302364f0796c06302b2487819bb09d66d3c6dd5161999af21ecb1e4e769f7ff0a3be287620774811f3
7
+ data.tar.gz: 340ae2e8bf451994e1f960a5c8196bd1739790b2e7634ded97c1990fb12d0c121078a301e8fcb9408a7bf63ce8f096730d8f038817fd18eb29a2114c7f6eeca0
data/README.md CHANGED
@@ -232,9 +232,4 @@ PgLocksMonitor.configure do |config|
232
232
 
233
233
  config.notifier_class = PgLocksEmailNotifier
234
234
  end
235
-
236
235
  ```
237
-
238
- ## Contributions
239
-
240
- This gem is in a very early stage of development so feedback and PRs are welcome.
@@ -13,7 +13,11 @@ module PgLocksMonitor
13
13
  if (age = lock.fetch("age"))
14
14
  (ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.locks_min_duration_ms
15
15
  end
16
- end.select(&configuration.locks_filter_proc)
16
+ end.select do |lock|
17
+ # meta locks with duplicate data
18
+ lock.fetch("locktype") != "virtualxid"
19
+ end
20
+ .select(&configuration.locks_filter_proc)
17
21
  .first(configuration.locks_limit)
18
22
 
19
23
  if locks.count > 0 && configuration.monitor_locks
@@ -22,7 +26,7 @@ module PgLocksMonitor
22
26
 
23
27
  blocking = RailsPgExtras.blocking(in_format: :hash).select do |block|
24
28
  if (age = block.fetch("blocking_duration"))
25
- (ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.locks_min_duration_ms
29
+ (ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.blocking_min_duration_ms
26
30
  end
27
31
  end.select(&configuration.blocking_filter_proc)
28
32
  .first(configuration.locks_limit)
@@ -44,22 +48,6 @@ module PgLocksMonitor
44
48
  def self.configure
45
49
  yield(configuration)
46
50
  end
47
-
48
- class DurationHelper
49
- require "date"
50
-
51
- def self.parse_to_ms(duration_str)
52
- time = DateTime.strptime(duration_str, "%H:%M:%S.%N")
53
- hours = time.hour
54
- minutes = time.minute
55
- seconds = time.second
56
- nanoseconds = time.second_fraction * (10 ** 9)
57
-
58
- total_ms = (hours * 3600 * 1000) + (minutes * 60 * 1000) + (seconds * 1000) + (nanoseconds / 1_000_000).to_i
59
-
60
- total_ms
61
- end
62
- end
63
51
  end
64
52
 
65
53
  require "pg_locks_monitor/default_notifier"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgLocksMonitor
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg-locks-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-04 00:00:00.000000000 Z
11
+ date: 2024-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-pg-extras