diff --git a/Makefile b/Makefile index 47682f67..dd0a2c25 100644 --- a/Makefile +++ b/Makefile @@ -37,11 +37,11 @@ setup-protobuf-macos: @go get github.com/golang/protobuf/protoc-gen-go run-jaeger-aio: - @docker-compose -f ./examples/testing/docker-compose-jaeger.yml up -d + @docker compose -f ./examples/testing/docker-compose-jaeger.yml up -d @echo "Access jaeger UI @ http://localhost:16686" run-chat-example: - @cd examples/testing && docker-compose up -d etcd nats && cd ../demo/chat/ && go run main.go + @cd examples/testing && docker compose up -d etcd nats && cd ../demo/chat/ && go run main.go run-cluster-example-frontend-tracing: @PITAYA_METRICS_PROMETHEUS_PORT=9090 JAEGER_SAMPLER_PARAM=1 JAEGER_DISABLED=false JAEGER_SERVICE_NAME=example-frontend JAEGER_AGENT_PORT=6832 go run examples/demo/cluster/main.go @@ -98,16 +98,16 @@ ensure-testing-bin: @[ -f ./examples/testing/server ] || go build -o ./examples/testing/server ./examples/testing/main.go ensure-testing-deps: - @cd ./examples/testing && docker-compose up -d + @cd ./examples/testing && docker compose up -d ensure-e2e-deps-grpc: - @cd ./examples/testing && docker-compose up -d etcd + @cd ./examples/testing && docker compose up -d etcd kill-testing-deps: - @cd ./examples/testing && docker-compose down; true + @cd ./examples/testing && docker compose down; true kill-jaeger: - @docker-compose -f ./examples/testing/docker-compose-jaeger.yml down; true + @docker compose -f ./examples/testing/docker-compose-jaeger.yml down; true e2e-test: e2e-test-nats e2e-test-grpc diff --git a/README.md b/README.md index c5c50b6c..75b7efcb 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Here's one example of running Pitaya: Start etcd (This command requires docker-compose and will run an etcd container locally. An etcd may be run without docker if preferred.) ``` -cd ./examples/testing && docker-compose up -d etcd +cd ./examples/testing && docker compose up -d etcd ``` run the connector frontend server from cluster_grpc example ``` diff --git a/examples/demo/chat/README.md b/examples/demo/chat/README.md index 8a4238fb..c564a381 100644 --- a/examples/demo/chat/README.md +++ b/examples/demo/chat/README.md @@ -9,7 +9,7 @@ refs: https://github.com/topfreegames/pitaya ## Run ``` -docker-compose -f ../../testing/docker-compose.yml up -d etcd nats +docker compose -f ../../testing/docker-compose.yml up -d etcd nats go run main.go ``` diff --git a/service/handler.go b/service/handler.go index 2a18e453..a2cb48ec 100644 --- a/service/handler.go +++ b/service/handler.go @@ -189,7 +189,12 @@ func (h *HandlerService) Handle(conn acceptor.PlayerConn) { } else if err == constants.ErrConnectionClosed { logger.Log.Debugf("Connection no longer available while reading next available message: %s", err.Error()) } else { - logger.Log.Errorf("Error reading next available message: %s", err.Error()) + // Differentiate errors for valid sessions, to avoid noise from load balancer healthchecks and other internet noise + if a.GetStatus() != constants.StatusStart { + logger.Log.Errorf("Error reading next available message for UID: %s, Build: %s, error: %s", a.GetSession().UID(), "a.GetSession().GetHandshakeData().Sys.BuildNumber", err.Error()) + } else { + logger.Log.Debugf("Error reading next available message on initial connection: %s", err.Error()) + } } return diff --git a/service/handler_test.go b/service/handler_test.go index 98b1e80a..ea197569 100644 --- a/service/handler_test.go +++ b/service/handler_test.go @@ -418,16 +418,18 @@ func TestHandlerServiceHandle(t *testing.T) { mockAgent.EXPECT().SendHandshakeResponse().Return(nil) mockSession := mocks.NewMockSession(ctrl) + mockSession.EXPECT().GetHandshakeData().Return(&session.HandshakeData{Sys: session.HandshakeClientData{BuildNumber: "10"}}).AnyTimes() mockSession.EXPECT().SetHandshakeData(gomock.Any()).Times(1) mockSession.EXPECT().ValidateHandshake(gomock.Any()).Times(1) - mockSession.EXPECT().UID().Return("uid").Times(1) + mockSession.EXPECT().UID().Return("uid").AnyTimes() mockSession.EXPECT().ID().Return(int64(1)).Times(2) mockSession.EXPECT().Set(constants.IPVersionKey, constants.IPv4) mockSession.EXPECT().Close() mockAgent.EXPECT().String().Return("") + mockAgent.EXPECT().GetStatus().AnyTimes() mockAgent.EXPECT().SetStatus(constants.StatusHandshake) - mockAgent.EXPECT().GetSession().Return(mockSession).Times(7) + mockAgent.EXPECT().GetSession().Return(mockSession).AnyTimes() mockAgent.EXPECT().IPVersion().Return(constants.IPv4) mockAgent.EXPECT().RemoteAddr().Return(&mockAddr{}).AnyTimes() mockAgent.EXPECT().SetLastAt().Do(func() {