Skip to content

Commit 74bc2ba

Browse files
committed
Close StatementClient when hitting client-side timeout
1 parent 55c3bdc commit 74bc2ba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/trino/client/statement_client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,15 @@ def raise_if_timeout!
233233
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at
234234

235235
if @query_timeout && elapsed > @query_timeout
236+
close
236237
raise_timeout_error!
237238
end
238239

239240
if @plan_timeout && (@results == nil || @results.columns == nil) &&
240241
elapsed > @plan_timeout
241242
# @results is not set (even first faraday_get_with_retry isn't called yet) or
242243
# result from Trino doesn't include result schema. Query planning isn't done yet.
244+
close
243245
raise_timeout_error!
244246
end
245247
end

0 commit comments

Comments
 (0)