Skip to content

Commit

Permalink
Exclude locks without age [#2]
Browse files Browse the repository at this point in the history
  • Loading branch information
pawurb committed Sep 17, 2024
1 parent 4afad7c commit 30bc282
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/pg-locks-monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ def self.snapshot!
limit: configuration.locks_limit,
},
).select do |lock|
(ActiveSupport::Duration.parse(lock.fetch("age")).to_f * 1000) > configuration.locks_min_duration_ms
if (age = lock.fetch("age"))
(ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.locks_min_duration_ms
end
end

if locks.present? && configuration.monitor_locks
Expand Down
2 changes: 1 addition & 1 deletion lib/pg_locks_monitor/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module PgLocksMonitor
VERSION = "0.1.1"
VERSION = "0.1.2"
end

0 comments on commit 30bc282

Please sign in to comment.