Skip to content

Commit 81e621d

Browse files
committed
fixup: improve based on gemini feedback
Signed-off-by: Simon Schrottner <[email protected]>
1 parent b6c9664 commit 81e621d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

providers/flagd/pkg/provider.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ func NewProvider(opts ...ProviderOption) (*Provider, error) {
8181
})
8282
}
8383

84-
provider.hooks = append(provider.hooks, NewSyncContextHook(func() *of.EvaluationContext {
85-
return provider.providerConfiguration.ContextEnricher(service.ContextValues())
86-
}))
84+
if provider.providerConfiguration.Resolver == inProcess {
85+
provider.hooks = append(provider.hooks, NewSyncContextHook(func() *of.EvaluationContext {
86+
return provider.providerConfiguration.ContextEnricher(service.ContextValues())
87+
}))
88+
}
8789
provider.service = service
8890

8991
return provider, nil

providers/flagd/pkg/service/in_process/service.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ func (i *InProcess) Init() error {
115115
// re-syncs are ignored as we only support single flag sync source
116116
changes, _, err := i.evaluator.SetState(data)
117117
if data.SyncContext != nil {
118+
i.mtx.Lock()
118119
i.contextValues = data.SyncContext.AsMap()
120+
i.mtx.Unlock()
119121
}
120122

121123
if err != nil {

0 commit comments

Comments
 (0)