Skip to content

Commit

Permalink
move context calculations out of a go routine
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidlazio committed May 22, 2024
1 parent f636ad9 commit f5753b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 6 additions & 7 deletions confidence/confidence.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,15 @@ func (e Confidence) PutContext(key string, value interface{}) {
}

func (e Confidence) Track(ctx context.Context, eventName string, message map[string]interface{}) {
newMap := e.GetContext()

for key, value := range message {
newMap[key] = value
}

go func() {
currentTime := time.Now()
iso8601Time := currentTime.Format(time.RFC3339)

newMap := e.GetContext()

for key, value := range message {
newMap[key] = value
}

event := Event {
EventDefinition: fmt.Sprintf("eventDefinitions/%s", eventName),
EventTime: iso8601Time,
Expand Down
3 changes: 1 addition & 2 deletions demo/GoDemoApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"time"

"github.com/google/uuid"
"github.com/open-feature/go-sdk/openfeature"
Expand All @@ -12,7 +11,7 @@ import (
)

func main() {
clientSecret := "xa0fQ4WKSvuxdjPtesupleiSbZeik6Gf"
clientSecret := "CLIENT_SECRET"
fmt.Println("Fetching the flags...")

confidence := c.NewConfidenceBuilder().SetAPIConfig(c.APIConfig{APIKey: clientSecret}).Build()
Expand Down

0 comments on commit f5753b1

Please sign in to comment.