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

fix: config fetcher called twice #305

Closed

Conversation

voslartomas
Copy link
Contributor

@voslartomas voslartomas commented Nov 28, 2023

Motivation and Context

Config fetcher Subscribe method was called twice, because of init config channel, therefore it was calling 2 requests to control panel at the same time (also logging twice, that is how I noticed).

Logs

{"level":"debug","time":1701182852460,"caller":"controlplane/configfetcher.go:85","msg":"No new router config available, received nil router config, trying again in 10 seconds","hostname":"cosmo-router-7598cf9d5b-6wbmt","pid":1,"component":"@wundergraph/router","service_version":"0.39.0"}
{"level":"debug","time":1701182852523,"caller":"controlplane/configfetcher.go:85","msg":"No new router config available, received nil router config, trying again in 10 seconds","hostname":"cosmo-router-7598cf9d5b-6wbmt","pid":1,"component":"@wundergraph/router","service_version":"0.39.0"}
{"level":"debug","time":1701182853064,"caller":"controlplane/configfetcher.go:85","msg":"No new router config available, received nil router config, trying again in 10 seconds","hostname":"cosmo-router-7598cf9d5b-6wbmt","pid":1,"component":"@wundergraph/router","service_version":"0.39.0"}

Notice mainly first two logs called almost at the same time
Screenshot 2023-11-28 at 15 53 29

Plus small fix to logs to include pollInterval instead of hardcoded value as it can be changed.

@voslartomas voslartomas changed the title fix/fetcher called twice fix: Config fetcher called twice Nov 28, 2023
@voslartomas voslartomas changed the title fix: Config fetcher called twice fix: config fetcher called twice Nov 28, 2023
@StarpTech
Copy link
Contributor

Hi @voslartomas, thank you for the PR. We did a refactoring in #318 which addresses the issue.

@StarpTech StarpTech closed this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants