Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: gateway backend config initialisation improvements #3688

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

atzoum
Copy link
Contributor

@atzoum atzoum commented Jul 31, 2023

Description

  • Respect the context in gateway.backendConfigSubscriber
  • Wait until the first configuration has been consumed by the gateway before starting gateway's http listeners
  • Add some more information in the Workspace Config changed log, such as the number of workspaces and total sources contained in the updated configuration.

Linear Ticket

Link

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@atzoum atzoum force-pushed the chore.wcDebugInfo branch 2 times, most recently from b54ec2e to 9d6baee Compare July 31, 2023 14:43
@codecov
Copy link

codecov bot commented Jul 31, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.17% ⚠️

Comparison is base (2bc503d) 68.27% compared to head (35fa612) 68.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3688      +/-   ##
==========================================
- Coverage   68.27%   68.10%   -0.17%     
==========================================
  Files         319      319              
  Lines       50447    50456       +9     
==========================================
- Hits        34442    34365      -77     
- Misses      13786    13865      +79     
- Partials     2219     2226       +7     
Files Changed Coverage Δ
backend-config/backend-config.go 84.12% <100.00%> (-0.07%) ⬇️
gateway/gateway.go 80.00% <100.00%> (+0.17%) ⬆️

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1307,7 +1309,7 @@ This function will block.
*/
func (gateway *HandleT) StartWebHandler(ctx context.Context) error {
gateway.logger.Infof("WebHandler waiting for BackendConfig before starting on %d", webPort)
gateway.backendConfig.WaitForConfig(ctx)
<-gateway.configInitialisedChan
Copy link
Member

@achettyiitr achettyiitr Aug 2, 2023

Choose a reason for hiding this comment

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

Should we honor context as well here? Same for below as well?

	switch {
	case <-gateway.configInitialisedChan
		return
	case <-ctx:
		return
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not necessary since:

  1. the context passed to HandleT#StartWebHandler is exactly the same as the one passed to HandleT#Setup and HandleT#backendConfigSubscriber
  2. the channel will be closed if when the context is canceled, this happens inside HandleT#backendConfigSubscriber

@atzoum atzoum merged commit 3cca234 into master Aug 2, 2023
35 checks passed
@atzoum atzoum deleted the chore.wcDebugInfo branch August 2, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants