From cd749223abfd35293c622fdd9d32f70dfc476f6a Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 7 Dec 2024 02:05:20 +0900 Subject: [PATCH] Make sure sending cancel request in StatementClient.close() --- lib/trino/client/statement_client.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/trino/client/statement_client.rb b/lib/trino/client/statement_client.rb index 1f2c94e6..178922ba 100644 --- a/lib/trino/client/statement_client.rb +++ b/lib/trino/client/statement_client.rb @@ -262,9 +262,11 @@ def cancel_leaf_stage end def close - return unless running? - - @state = :client_aborted + return if finished? || query_failed? || client_aborted? + + if running? + @state = :client_aborted + end begin if uri = @results.next_uri