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: gcp retriever is able get the updated flags file #311

Merged
merged 11 commits into from
Aug 31, 2022

Conversation

jferrl
Copy link
Contributor

@jferrl jferrl commented Aug 20, 2022

Description

What was the problem?

It was not possible to use an instance of gcstorageretriever.Retriever{} since it is only able to get the file on the initial bootstrap of go-feature-flag instance. After feature flag client is up and running, the internal flags cache is no longer updated when gcstorageretriever is used.

How it is resolved?

The issue has been resolved avoiding the use of the file reader as a field of Retriever. So, after the first bootstrap of Retriever the file reader was closed because the code closes the reader after done reading. If we try out another call to Retriever.Retrieve() the reader is not nil and it was closed, so that, it was not able to get the updated file. In that case, we could see some log trace like:

fmt.Errorf("unable to read from GCP Object %s in Bucket %s, error: %s", retriever.Bucket, retriever.Object, err)

How can we test the change?

  • Unit tests
  • Example script using gcstorageretriever.Retriever{}

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking changes (change that is not backward-compatible and/or changes current functionality)

Closes issue(s)

#310

Checklist

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

jferrl added 3 commits August 20, 2022 15:21
- Remove internal file reader
- Remove not need interface object
- Improve unit tests avoiding the use of storage mocks
@auto-assign auto-assign bot requested a review from thomaspoignant August 20, 2022 16:55
@jferrl jferrl changed the title Fix/gcs retriever fix: gcp retriever is able get the updated flags file Aug 20, 2022
@coveralls
Copy link

coveralls commented Aug 20, 2022

Coverage Status

Coverage increased (+0.3%) to 95.096% when pulling d40639c on jferrl:fix/gcs-retriever into b7fd690 on thomaspoignant:main.

@thomaspoignant
Copy link
Owner

Don't worry about the linting issue, I will fix it in another PR and will works for you.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
2.0% 2.0% Duplication

@jferrl
Copy link
Contributor Author

jferrl commented Aug 31, 2022

@thomaspoignant PR able to merge! 🚀

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.

Thanks a lot for you contribution @jferrl
Sorry for the delay in the review.

I will release a new version with this fix today.

@thomaspoignant thomaspoignant merged commit 51bb4ff into thomaspoignant:main Aug 31, 2022
@jferrl jferrl deleted the fix/gcs-retriever branch August 31, 2022 16:34
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.

3 participants