Skip to content

Commit

Permalink
Add feature value unpack step to load test
Browse files Browse the repository at this point in the history
Signed-off-by: khorshuheng <[email protected]>
  • Loading branch information
khorshuheng committed Jan 19, 2021
1 parent f666e75 commit e1a80cb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
if len(requests) == 1 {
_, err := client.GetOnlineFeatures(ctx, &requests[0])
resp, err := client.GetOnlineFeatures(ctx, &requests[0])
if err != nil {
log.Fatalf("%v", err)
}
postProcessResponse(resp)
w.WriteHeader(200)
} else {
var wg sync.WaitGroup
Expand All @@ -75,10 +76,11 @@ func main() {
request := request
go func() {
defer wg.Done()
_, err := client.GetOnlineFeatures(ctx, &request)
resp, err := client.GetOnlineFeatures(ctx, &request)
if err != nil {
fatalErrors <- err
}
postProcessResponse(resp)
}()
}

Expand Down Expand Up @@ -120,3 +122,11 @@ func main() {
}
}

func postProcessResponse(resp *feast.OnlineFeaturesResponse) {
for _, fieldValue := range resp.RawResponse.FieldValues {
for _, field := range fieldValue.Fields {
field.GetVal()
}
}
}

0 comments on commit e1a80cb

Please sign in to comment.