Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update several libraries and dependencies
  • Loading branch information
victor-carvalho authored Jun 21, 2021
1 parent dbe567b commit b07d23b
Showing 15 changed files with 484 additions and 233 deletions.
6 changes: 4 additions & 2 deletions cluster/etcd_service_discovery.go
Original file line number Diff line number Diff line change
@@ -28,8 +28,8 @@ import (
"sync"
"time"

"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/clientv3/namespace"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/clientv3/namespace"
"github.com/topfreegames/pitaya/v2/config"
"github.com/topfreegames/pitaya/v2/constants"
"github.com/topfreegames/pitaya/v2/logger"
@@ -587,9 +587,11 @@ func (sd *etcdServiceDiscovery) watchEtcdChanges() {
case wResp, ok := <-chn:
if wResp.Err() != nil {
logger.Log.Warnf("etcd watcher response error: %s", wResp.Err())
time.Sleep(100 * time.Millisecond)
}
if !ok {
logger.Log.Error("etcd watcher died")
time.Sleep(100 * time.Millisecond)
}
for _, ev := range wResp.Events {
svType, svID, err := parseEtcdKey(string(ev.Kv.Key))
2 changes: 1 addition & 1 deletion cluster/etcd_service_discovery_test.go
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ import (
"testing"
"time"

"github.com/coreos/etcd/clientv3"
"go.etcd.io/etcd/clientv3"
"github.com/stretchr/testify/assert"
"github.com/topfreegames/pitaya/v2/config"
"github.com/topfreegames/pitaya/v2/constants"
9 changes: 6 additions & 3 deletions cluster/nats_rpc_client_test.go
Original file line number Diff line number Diff line change
@@ -430,8 +430,8 @@ func TestNatsRPCClientCall(t *testing.T) {
}{
{"test_error", &protos.Response{Data: []byte("nok"), Error: &protos.Error{Msg: "nok"}}, nil, e.NewError(errors.New("nok"), e.ErrUnknownCode)},
{"test_ok", &protos.Response{Data: []byte("ok")}, &protos.Response{Data: []byte("ok")}, nil},
{"test_bad_response", []byte("invalid"), nil, errors.New("unexpected EOF")},
{"test_bad_proto", &protos.Session{Id: 1, Uid: "snap"}, nil, errors.New("unexpected EOF")},
{"test_bad_response", []byte("invalid"), nil, errors.New("cannot parse invalid wire-format data")},
{"test_bad_proto", &protos.Session{Id: 1, Uid: "snap"}, nil, errors.New("cannot parse invalid wire-format data")},
{"test_no_response", nil, nil, errors.New("nats: timeout")},
}

@@ -468,7 +468,10 @@ func TestNatsRPCClientCall(t *testing.T) {

res, err := rpcClient.Call(context.Background(), protos.RPCType_Sys, rt, ss, msg, sv2)
assert.Equal(t, table.expected, res)
assert.Equal(t, table.err, err)
if table.err != nil {
assert.Error(t, err)
assert.Contains(t, err.Error(), table.err.Error())
}
err = subs.Unsubscribe()
assert.NoError(t, err)
conn.Close()
2 changes: 1 addition & 1 deletion defaultpipelines/default_struct_validator.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import (
"context"
"sync"

validator "gopkg.in/go-playground/validator.v9"
validator "github.com/go-playground/validator/v10"
)

// DefaultValidator is the default arguments validator for handlers
4 changes: 2 additions & 2 deletions examples/demo/pipeline/main.go
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ func (g *MetagameServer) HandlerNoArg(ctx context.Context) (*HandlerNoArgRespons
// IMPORTANT: that this kind of pipeline will be hard to exist in real code
// as a pipeline function executes for every handler and each of them
// most probably have different parameter types.
func (g *MetagameServer) simpleBefore(ctx context.Context, in interface{}) (interface{}, error) {
func (g *MetagameServer) simpleBefore(ctx context.Context, in interface{}) (context.Context, interface{}, error) {
logger := pitaya.GetDefaultLoggerFromCtx(ctx)
logger.Info("Simple Before exec")

@@ -76,7 +76,7 @@ func (g *MetagameServer) simpleBefore(ctx context.Context, in interface{}) (inte
logger.Infof("SoftCurrency: %d", createPlayerArgs.SoftCurrency)
logger.Infof("HardCurrency: %d", createPlayerArgs.HardCurrency)
}
return in, nil
return ctx, in, nil
}

// Simple example of an after pipeline. The 2nd argument is the handler response.
55 changes: 18 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
@@ -3,53 +3,34 @@ module github.com/topfreegames/pitaya/v2
go 1.12

require (
github.com/DataDog/datadog-go v4.2.0+incompatible
github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7 // indirect
github.com/DataDog/datadog-go v4.5.0+incompatible
github.com/HdrHistogram/hdrhistogram-go v1.1.0 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
github.com/coreos/etcd v3.3.13+incompatible
github.com/customerio/gospec v0.0.0-20130710230057-a5cc0e48aa39 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/garyburd/redigo v1.6.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-playground/locales v0.12.1 // indirect
github.com/go-playground/universal-translator v0.16.0 // indirect
github.com/go-playground/validator/v10 v10.4.1
github.com/gogo/protobuf v1.3.0 // indirect
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.3
github.com/google/uuid v1.1.4
github.com/gorilla/websocket v1.4.2
github.com/jhump/protoreflect v1.5.0
github.com/jonboulle/clockwork v0.1.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/jhump/protoreflect v1.8.2
github.com/leodido/go-urn v1.2.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/nats-io/gnatsd v1.4.1
github.com/nats-io/go-nats v1.5.0 // indirect
github.com/nats-io/nats-server v1.4.1
github.com/nats-io/nats-server/v2 v2.0.4 // indirect
github.com/nats-io/nats.go v1.10.0
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/opentracing/opentracing-go v1.0.2
github.com/nats-io/nats-server/v2 v2.2.0
github.com/nats-io/nats.go v1.10.1-0.20210228004050-ed743748acac
github.com/opentracing/opentracing-go v1.2.0
github.com/orfjackal/nanospec.go v0.0.0-20120727230329-de4694c1d701 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/prometheus/client_golang v0.9.3
github.com/sirupsen/logrus v1.7.0
github.com/soheilhy/cmux v0.1.4 // indirect
github.com/prometheus/client_golang v1.10.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
github.com/topfreegames/go-workers v1.0.1
github.com/uber-go/atomic v1.3.2 // indirect
github.com/uber/jaeger-client-go v2.13.0+incompatible
github.com/uber/jaeger-lib v1.4.0 // indirect
github.com/ugorji/go v0.0.0-20180112141927-9831f2c3ac10 // indirect
golang.org/x/net v0.0.0-20201224014010-6772e930b67b
google.golang.org/grpc v1.21.1
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v9 v9.31.0
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/uber/jaeger-lib v2.4.0+incompatible // indirect
go.etcd.io/etcd v0.0.0-20210226220824-aa7126864d82
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12
)
Loading

0 comments on commit b07d23b

Please sign in to comment.