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

feat: Add initial delay for polling feature configuration #2257

Conversation

samuolis
Copy link

Description

  • Added pollingDelayInMillis in initialize options, to declare delay for the first request of feature flags
  • Added tests to cover this case

This should solve the issue of getting feature flags before the first polling even happened (Default delay is 5 mins, it is okay for polling but not okay for waiting for initial data)

Checklist

  • I have tested this code
  • I have added unit test to cover this code
  • I have updated the documentation (README.md and /website/docs)
  • I have followed the contributing guide

Copy link

netlify bot commented Aug 23, 2024

Deploy Preview for go-feature-flag-doc-preview canceled.

Name Link
🔨 Latest commit e7202d3
🔍 Latest deploy log https://app.netlify.com/sites/go-feature-flag-doc-preview/deploys/66d6b83c86ba260008f03ea0

@samuolis samuolis changed the title Add initial delay for polling feature configuration feat: Add initial delay for polling feature configuration Aug 23, 2024
@samuolis
Copy link
Author

samuolis commented Aug 23, 2024

@thomaspoignant Do this library need code duplication check on tests, because it is falling on already existing tests?

Edit:
Changed sonar config to include those files, there was typo

@thomaspoignant
Copy link
Owner

thomaspoignant commented Aug 24, 2024

@samuolis thanks for your pull request, it fixes an important problem from the provider.

I am currently away (taking some vacation), but I will look closely to your PR early September and we will be able to release a new version of the provider with this addition.

For the code duplication, this should not be a problem for test, thanks for the sonar fix 🙏

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.02%. Comparing base (eec11f3) to head (e7202d3).
Report is 58 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2257   +/-   ##
=======================================
  Coverage   86.02%   86.02%           
=======================================
  Files         102      102           
  Lines        3743     3743           
=======================================
  Hits         3220     3220           
  Misses        399      399           
  Partials      124      124           

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

Copy link

sonarcloud bot commented Sep 3, 2024

Copy link
Owner

@thomaspoignant thomaspoignant left a comment

Choose a reason for hiding this comment

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

Hi @samuolis,

thanks for your contribution! I appreciate you taking the time to submit a pull request.

I'd like to understand a bit more about the context of your changes in this PR. While reviewing the code, I noticed that the initial API call to retrieve flags happens before polling starts.


This design approach ensures that flags are available immediately, even before the first polling cycle.

Could you elaborate on the specific issue you're trying to address with this pull request? Understanding your thought process will help me provide more relevant feedback.

If you have any questions or need further clarification on the current implementation, feel free to ask! I'm happy to discuss this further.

@@ -2,7 +2,7 @@ sonar.organization=thomaspoignant
sonar.projectKey=thomaspoignant_go-feature-flag
sonar.projectName=GO Feature Flag GitHub action
sonar.sources=.
sonar.exclusions=**/*_test.go, examples/**, openfeature/provider_tests/**, **/test_*.py, openfeature/providers/kotlin-provider/gofeatureflag=kotlin-provider/src/test/**, cmd/relayproxy/helm-charts/**
sonar.exclusions=**/*_test.go, examples/**, openfeature/provider_tests/**, **/test_*.py, openfeature/providers/kotlin-provider/gofeatureflag-kotlin-provider/src/test/**, cmd/relayproxy/helm-charts/**
Copy link
Owner

Choose a reason for hiding this comment

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

Oh, good catch 👌
I want to fast here 🤦

@samuolis
Copy link
Author

Sorry for such a delay, I missed this line somehow. I now see what was the problem, somehow the first API call was getting cancelled, now it works perfectly

@samuolis samuolis closed this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants