Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

[Backport 5.1] conf: Fix httpcli config#54763

Merged
coury-clark merged 1 commit into
5.1from
backport-54745-to-5.1
Jul 10, 2023
Merged

[Backport 5.1] conf: Fix httpcli config#54763
coury-clark merged 1 commit into
5.1from
backport-54745-to-5.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

See this comment for the source issue. Looks like #52242 introduced a condition where certain httpcli settings were not being configured in the frontend due to some cyclic package dependency-avoidance trickery in the conf.Init function.

This PR ensures that this setup code is hit in the frontend initialization process. No other service should need this (as they hit the conf.Init function directly from SingleServiceMain on startup), and no other feature should have been affected (as these are the only settings missing from that path).

Test plan

Tested locally.
Backport e715340 from #54745

(cherry picked from commit e715340)
@sourcegraph-bot

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@efritz efritz requested a review from a team July 10, 2023 19:53
@coury-clark coury-clark merged commit 95fd483 into 5.1 Jul 10, 2023
@coury-clark coury-clark deleted the backport-54745-to-5.1 branch July 10, 2023 19:54
Comment thread CHANGELOG.md

-

## 5.1.2

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.

@sourcegraph/release-guild help what did I do lmao

@coury-clark coury-clark Jul 10, 2023

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.

cherry-pick can pull in unrelated lines because of the 3-way merge

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.

We aren't maintaining the changelog on the release branch anymore, so its' not a big deal

Comment thread internal/conf/init.go
// in this package as conf itself uses httpcli's internal client.
func EnsureHTTPClientIsConfigured() {
ensureHTTPClientIsConfiguredOnce.Do(func() {
go Watch(func() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@efritz drive-by comment: I realize this is just copied from the previous implementation, but is this supposed to be called in a goroutine? Right now, this will return before the client is configured...which seems funny for a function called EnsureHTTPClientIsConfigured

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.

conf.Watch should be safe to call before init (according to its docstring)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, my question isn't about safety. It's about whether the client should be configured by the time EnsureHTTPClientIsConfigured returns. Right now, it's not because of the go on line 31.

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, it was originally called within a goroutine from Init above, so it might be a bad name but I think the behavior is correct. We can fix this on main.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cool, sounds good 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants