Sha256: e3adb7a439458dabf5fbff7f0d199563d0946b0051beab5e0aeca12ce2855309
Contents?: true
Size: 647 Bytes
Versions: 3
Compression:
Stored size: 647 Bytes
Contents
module PgHero module Methods module Kill def kill(pid) truthy? execute("SELECT pg_terminate_backend(#{pid.to_i})").first["pg_terminate_backend"] 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.4.2 | lib/pghero/methods/kill.rb |
pghero-1.4.1 | lib/pghero/methods/kill.rb |
pghero-1.4.0 | lib/pghero/methods/kill.rb |