From e31a82cb819f90ac943410bf4c165d6aad7d91ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Fernandes?= Date: Mon, 31 Jul 2023 11:37:09 +0100 Subject: [PATCH] Improve satori client --- internal/satori/satori.go | 14 ++++++++++++++ .../heroiclabs/nakama-common/runtime/runtime.go | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/satori/satori.go b/internal/satori/satori.go index b6514dd423..30b9628b81 100644 --- a/internal/satori/satori.go +++ b/internal/satori/satori.go @@ -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 @@ -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) @@ -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 @@ -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 @@ -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) @@ -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) @@ -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) diff --git a/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go b/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go index 48b9e30be7..bf6418d15b 100644 --- a/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go +++ b/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go @@ -1210,6 +1210,6 @@ type LiveEvent struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Value string `json:"value,omitempty"` - ActiveStartTimeSec int64 `json:"active_start_time_sec,omitempty"` - ActiveEndTimeSec int64 `json:"active_end_time_sec,omitempty"` + ActiveStartTimeSec int64 `json:"active_start_time_sec,string,omitempty"` + ActiveEndTimeSec int64 `json:"active_end_time_sec,string,omitempty"` }