Sha256: 0ec90de3331b96e65203d65cf6a29c7375c8781a995d82d87932918cef3902ca
Contents?: true
Size: 646 Bytes
Versions: 3
Compression:
Stored size: 646 Bytes
Contents
module PgHero module Methods module Kill def kill(pid) execute("SELECT pg_terminate_backend(#{pid.to_i})").first["pg_terminate_backend"] == "t" end def kill_long_running_queries long_running_queries.each { |query| kill(query["pid"]) } true end def kill_all select_all <<-SQL SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND query <> '<insufficient privilege>' AND datname = current_database() SQL true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pghero-1.3.2 | lib/pghero/methods/kill.rb |
pghero-1.3.1 | lib/pghero/methods/kill.rb |
pghero-1.3.0 | lib/pghero/methods/kill.rb |