fix: respect custom query timeout in ping() method#246
Open
abodnar wants to merge 3 commits intosmi2:masterfrom
Open
fix: respect custom query timeout in ping() method#246abodnar wants to merge 3 commits intosmi2:masterfrom
abodnar wants to merge 3 commits intosmi2:masterfrom
Conversation
added 3 commits
March 5, 2026 11:56
ping() was only setting CURLOPT_CONNECTTIMEOUT via connectTimeOut() but never called timeOut(), so CURLOPT_TIMEOUT always fell back to the hard-coded CurlerRequest default of 10 seconds, ignoring any value set via setTimeout(). Add .timeOut($this->settings()->getTimeOut()) to the request chain, matching the pattern already used in newRequest(). Co-Authored-By: Claude
Uses a local TCP server that completes the handshake but never sends an HTTP response, isolating CURLOPT_TIMEOUT from CURLOPT_CONNECTTIMEOUT so the assertion targets exactly the bug fixed in ping(). Co-Authored-By: Claude
ClientTest.setUp() requires a live ClickHouse connection, so the timeout test (which only needs a local socket server) is extracted into its own class to run without any external dependencies. Co-Authored-By: Claude
Author
|
The Scrutinizer issue seems outside the scope of what I've changed in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ping()creates aCurlerRequestand only calls.connectTimeOut()on it, never.timeOut(). This means CURLOPT_TIMEOUTalways falls back to the hard-coded default of10seconds inCurlerRequest, silently ignoring any value set viasetTimeout()`.Fix
Append
.timeOut($this->settings()->getTimeOut())to the request chain inping()(src/Transport/Http.php), matching the pattern already used innewRequest():Test
tests/PingTimeoutTest::testQueryTimeoutIsRespectedByPingspins up a local TCP server that completes the handshake but never sends an HTTP response. WithsetTimeout(1)and a highsetConnectTimeOut(5), the test asserts the operation times out in ~1 second — isolatingCURLOPT_TIMEOUTfrom the connect timeout and confirming the fix works without requiring a live ClickHouse server.Co-Authored with Claude Code