Skip to content

Commit

Permalink
Fix statsig context race condition (#236)
Browse files Browse the repository at this point in the history
Lock on store when reading the spec source
  • Loading branch information
kenny-statsig authored Oct 8, 2024
1 parent 6e44656 commit 14ddbee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func newClientImpl(sdkKey string, options *Options) (*Client, *initContext) {

func (c *Client) init(context *initContext) {
c.evaluator.initialize(context)
c.evaluator.store.mu.RLock()
defer c.evaluator.store.mu.RUnlock()
context.Success = c.evaluator.store.source != sourceUninitialized
context.Source = c.evaluator.store.source
}
Expand Down

0 comments on commit 14ddbee

Please sign in to comment.