Skip to content

Commit

Permalink
[#3] more fix for dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
pawurb committed Oct 2, 2024
1 parent 11a95ca commit 8d26e9a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/pg-locks-monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "uri"
require "pg"
require "ruby-pg-extras"

module PgLocksMonitor
def self.snapshot!
Expand All @@ -14,7 +15,7 @@ def self.snapshot!
end.select(&configuration.locks_filter_proc)
.first(configuration.locks_limit)

if locks.present? && configuration.monitor_locks
if locks.count > 0 && configuration.monitor_locks
configuration.notifier_class.call(locks)
end

Expand All @@ -23,7 +24,7 @@ def self.snapshot!
end.select(&configuration.blocking_filter_proc)
.first(configuration.locks_limit)

if blocking.present? && configuration.monitor_blocking
if blocking.count > 0 && configuration.monitor_blocking
configuration.notifier_class.call(blocking)
end
end
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.2.1"
VERSION = "0.2.2"
end
13 changes: 13 additions & 0 deletions spec/smoke_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require "spec_helper"

describe PgLocksMonitor do
describe "snapshot!" do
it "works" do
expect {
PgLocksMonitor.snapshot!
}.not_to raise_error
end
end
end

0 comments on commit 8d26e9a

Please sign in to comment.