Skip to content

Commit 14ddbee

Browse files
Fix statsig context race condition (#236)
Lock on store when reading the spec source
1 parent 6e44656 commit 14ddbee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ func newClientImpl(sdkKey string, options *Options) (*Client, *initContext) {
8282

8383
func (c *Client) init(context *initContext) {
8484
c.evaluator.initialize(context)
85+
c.evaluator.store.mu.RLock()
86+
defer c.evaluator.store.mu.RUnlock()
8587
context.Success = c.evaluator.store.source != sourceUninitialized
8688
context.Source = c.evaluator.store.source
8789
}

0 commit comments

Comments
 (0)