Skip to content

Commit

Permalink
Improve satori client (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviofernandes004 authored Jul 31, 2023
1 parent eff9544 commit 4bf4c19
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.5.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0
github.com/heroiclabs/nakama-common v1.28.0
github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380
github.com/jackc/pgconn v1.14.0
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
github.com/jackc/pgtype v1.14.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/heroiclabs/nakama-common v1.28.0 h1:oj6voT/3xOkOjeWzPVkrH0ATakZT6WNLL6i6kD6dqlE=
github.com/heroiclabs/nakama-common v1.28.0/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380 h1:cPpoIEukbm0RmM7jzLApRVYQeZp9G1Sg1RsvyxcJ0d4=
github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down
14 changes: 14 additions & 0 deletions internal/satori/satori.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ func (s *SatoriClient) Authenticate(ctx context.Context, id string) error {
return err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
return nil
Expand Down Expand Up @@ -198,6 +200,8 @@ func (s *SatoriClient) PropertiesGet(ctx context.Context, id string) (*runtime.P
return nil, err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
resBody, err := io.ReadAll(res.Body)
Expand Down Expand Up @@ -251,6 +255,8 @@ func (s *SatoriClient) PropertiesUpdate(ctx context.Context, id string, properti
return err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
return nil
Expand Down Expand Up @@ -315,6 +321,8 @@ func (s *SatoriClient) EventsPublish(ctx context.Context, id string, events []*r
return err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
return nil
Expand Down Expand Up @@ -361,6 +369,8 @@ func (s *SatoriClient) ExperimentsList(ctx context.Context, id string, names ...
return nil, err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
resBody, err := io.ReadAll(res.Body)
Expand Down Expand Up @@ -417,6 +427,8 @@ func (s *SatoriClient) FlagsList(ctx context.Context, id string, names ...string
return nil, err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
resBody, err := io.ReadAll(res.Body)
Expand Down Expand Up @@ -473,6 +485,8 @@ func (s *SatoriClient) LiveEventsList(ctx context.Context, id string, names ...s
return nil, err
}

defer res.Body.Close()

switch res.StatusCode {
case 200:
resBody, err := io.ReadAll(res.Body)
Expand Down
4 changes: 2 additions & 2 deletions vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopena
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options
github.com/grpc-ecosystem/grpc-gateway/v2/runtime
github.com/grpc-ecosystem/grpc-gateway/v2/utilities
# github.com/heroiclabs/nakama-common v1.28.0
# github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380
## explicit; go 1.19
github.com/heroiclabs/nakama-common/api
github.com/heroiclabs/nakama-common/rtapi
Expand Down

0 comments on commit 4bf4c19

Please sign in to comment.