Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/blazer/adapters/sql_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def cancel(run_id)
if postgresql?
select_all("SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND query LIKE ?", ["%,run_id:#{run_id}%"])
elsif redshift?
first_row = select_all("SELECT pid FROM stv_recents WHERE status = 'Running' AND query LIKE ?", ["%,run_id:#{run_id}%"]).first
run_text = "%,run_id:#{run_id}%"
first_row = select_all("SELECT pid FROM stv_recents WHERE status = 'Running' AND query LIKE ? UNION SELECT pid FROM stv_inflight WHERE text LIKE ?", [run_text, run_text]).first
if first_row
select_all("CANCEL #{first_row["pid"].to_i}")
end
Expand Down