https://www.growthbook.io/ logo
#announcements
Title
# announcements
w

worried-army-78112

09/12/2023, 7:57 AM
Hey everyone! We are trying to migrate to growthbook for feature flags (Go). However, the flags themselves don't update on GraphiQL, a restart is required for the changes to reflect. Is it because of caching? What could be the potential solution here?
👀 1
b

billions-xylophone-11752

09/12/2023, 12:05 PM
Hey, Pratik! Are you using the Cloud or Self-Hosted version of GrowthBook?
w

worried-army-78112

09/12/2023, 12:07 PM
Using Cloud Version. The realtime streaming works for 1-2 minutes and then it stops. It works fine if I restart my services again.
b

billions-xylophone-11752

09/12/2023, 12:09 PM
Gotcha. I'm not super familiar with the GO SDK - I've pinged a few others that are. I'll follow up here shortly.
w

worried-army-78112

09/12/2023, 12:09 PM
Thanks!
h

happy-autumn-40938

09/12/2023, 4:59 PM
Hi Pratik, are you seeing anything in the logs for your golang app?
s

salmon-apartment-14532

09/13/2023, 7:55 AM
Hey @happy-autumn-40938 we are not seeing anything in our apps. Also there is another issue that initial fetching of features doesn't fetch forced rules when adding
WithForcedVariations(growthbook.ForcedVariationsMap{})
in the context
This is how we are initializing the gb client
Copy code
growthBookContext := growthbook.NewContext().WithAPIHost(os.Getenv("GROWTH_BOOK_API_HOST")).WithClientKey(os.Getenv("GROWTH_BOOK_SDK_KEY")).WithForcedVariations(growthbook.ForcedVariationsMap{})

	gbClient := growthbook.New(growthBookContext)
	gbClient.LoadFeatures(&growthbook.FeatureRepoOptions{
		AutoRefresh: true,
	})
b

brief-honey-45610

09/13/2023, 7:43 PM
Hi Pratik, our Golang SDK was developed by an external contributor. I created 2 new GitHub issues related to your questions here, and our CEO Graham will reach out to the Go SDK maintainer regarding these issues.
a

alert-dream-63361

09/16/2023, 7:57 PM
Hi Pratik! Hi Umang! I'm the author of the Go SDK. I believe that the feature update problem should be fixed now. There was a problem with the SSE client library I was using: details at https://github.com/growthbook/growthbook-golang/issues/16 I'll take a look at this forced variations problem next. I'll get back to you!
Hi Pratik, To follow up on the other question you had about
WithForcedVariations
. I don't understand what the results you're expecting here are. I'll try to give some sort of explanation of what I think is going on, and you can tell me where it doesn't match what you're seeing. There are two distinct "forced" things you can do with the Go SDK (the other language SDKs behave in a similar way). You can force rules for features, which you set up on the GrowthBook site with conditions that say "if a user satisfies these conditions, then force them to have this value for this *feature*". I'm pretty sure that works correctly, since I use it for testing all the time. The
WithForcedVariations
thing is a separate mechanism that allows you to force the variation returned for an experiment. I think people mostly use it for QA purposes, since it allows you to examine what happens in your code when a particular experiment outcome happens. The code paths that reference this stuff don't influence the features that are downloaded by
LoadFeatures
and they only have an effect on experiment outcomes if the particular experiment key is in the forced variations map. Setting the forced variations map to an empty map shouldn't have any impact on anything at all. Can you confirm that you really are seeing a difference in the feature rules when you use
WithForcedVariations
? Just to give some context: Here is the code that implements
WithForcedVariations
, which just sets the forced variations map on the context: https://github.com/growthbook/growthbook-golang/blob/main/context.go#L107-L113 And here is the place where the forced variations map is referenced (in the
doRun
method which actually runs experiments and is called from
EvalFeature
) — if the map is non-empty and the experiment key is in the map, then the experiment variation (i.e. the integer index into the list of possible outcomes) is taken from the map: https://github.com/growthbook/growthbook-golang/blob/main/growthbook.go#L726-L734 Forcing of rules is handled here in
EvalFeature
— if a forcing rule exists for a user in the feature, then the forced value is returned immediately, without constructing and running an experiment for the feature (which means the forced variations map is never used in this code path): https://github.com/growthbook/growthbook-golang/blob/main/growthbook.go#L423-L444 The forced variations map isn't referenced anywhere else, so I can't see how it's possible for it to influence the effect of forcing rules. I hope this helps us get some way to understanding what's happening in your case!
b

brief-honey-45610

09/18/2023, 4:12 PM
Hey @worried-army-78112 and @salmon-apartment-14532, I just wanted to call your attention to the SDK fixes Ian was able to provide over the weekend. Please let us know if you have any follow-up questions.
s

salmon-apartment-14532

09/18/2023, 5:03 PM
Hey @alert-dream-63361 thanks for the sse fix. Regarding forced values issues. Let me explain by example. I have a feature named let's say
test-feature-1
which has default value as false. I have added forced values for rule
if uId = x then serve true
but the issue I am facing is even when uId is x, it is returning false instead of true.
My assumption is that growthbook client fetches all the features when calling
LoadFeatures
but this fetches the default values and since these are cached client doesn't know refresh values when evaluating with context with uId = x. Do you think removing explicit call to LoadFeatures() should solve the issue as features will be fetch as they are requested by clients and then they will get forced values based on evaluation context?
a

alert-dream-63361

09/18/2023, 7:18 PM
Let's discuss this in the GitHub issue: https://github.com/growthbook/growthbook-golang/issues/15 I've made a couple of comments there.
8 Views