Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion httpclient/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ func (cfg ClientConfig) httpTransport() http.RoundTripper {

func NewApiClient(cfg ClientConfig) *ApiClient {
// Set defaults for config values that are not set.
cfg.HTTPTimeout = time.Duration(orDefault(int(cfg.HTTPTimeout), int(30*time.Second)))

@renaudhartert-db renaudhartert-db Oct 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like the ApiClient to "own" its default values — see tests were the client is hard coding a value that is fundamentally controlled by the caller. Could we do the opposite by (i) removing the upstream default, and (ii) setting the value to 60 seconds here?

@shreyas-goenka shreyas-goenka Oct 6, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API client already has the timeout set. This PR removes a duplicate line of code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, I misunderstood the change as being about deferring the default logic to the Databricks config. All good 👍

cfg.DebugTruncateBytes = orDefault(cfg.DebugTruncateBytes, 96)
cfg.RetryTimeout = time.Duration(orDefault(int(cfg.RetryTimeout), int(5*time.Minute)))
cfg.HTTPTimeout = time.Duration(orDefault(int(cfg.HTTPTimeout), int(60*time.Second)))
Expand Down
4 changes: 2 additions & 2 deletions httpclient/api_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ func TestLogCancelledRequest(t *testing.T) {
err := c.Do(context.Background(), "GET", "/a")
assert.Error(t, err)
assert.Equal(t, `[DEBUG] GET /a
< Error: Get "/a": request timed out after 30s of inactivity
[DEBUG] non-retriable error: Get "/a": request timed out after 30s of inactivity
< Error: Get "/a": request timed out after 1m0s of inactivity
[DEBUG] non-retriable error: Get "/a": request timed out after 1m0s of inactivity
`, bufLogger.String())
}

Expand Down
Loading