Skip to content

Commit

Permalink
Fix race condition when closing not using the singleton (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant authored Dec 29, 2022
1 parent 6437371 commit f885050
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion feature_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func Init(config Config) error {

// Close the component by stopping the background refresh and clean the cache.
func Close() {
onceFF = sync.Once{}
ff.Close()
}

Expand Down Expand Up @@ -102,7 +103,6 @@ func New(config Config) (*GoFeatureFlag, error) {

// Close wait until thread are done
func (g *GoFeatureFlag) Close() {
onceFF = sync.Once{}
if g != nil {
if g.cache != nil {
// clear the cache
Expand Down

0 comments on commit f885050

Please sign in to comment.