Skip to content

Commit

Permalink
Merge pull request #250 from spiral/rr_1.6.1
Browse files Browse the repository at this point in the history
release 1.6.1
  • Loading branch information
rustatian authored Feb 17, 2020
2 parents 54ca82d + 0248077 commit 691e937
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ composer.lock
vendor
builds/
tests/vendor/
.rr.yaml
.rr-sample.yaml
psr-worker.php
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RR_VERSION=1.6.0
# Hardcode some values to the core package
LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.Version=${RR_VERSION}"
LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.BuildTime=$(date +%FT%T%z)"
# remove debug info from binary as well as string and symbol tables
LDFLAGS="$LDFLAGS -s"

build(){
echo Packaging $1 Build
Expand Down
24 changes: 24 additions & 0 deletions cmd/rr/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import (
"github.com/spiral/roadrunner/cmd/util"
"github.com/spiral/roadrunner/service"
"github.com/spiral/roadrunner/service/limit"
"log"
"net/http"
"net/http/pprof"
"os"
)

Expand Down Expand Up @@ -116,8 +119,29 @@ func init() {
})
}
}

// if debug --> also run pprof service
if Debug {
go runDebugServer()
}
})
}
func runDebugServer() {
mux := http.NewServeMux()
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
srv := http.Server{
Addr: ":6061",
Handler: mux,
}

if err := srv.ListenAndServe(); err != nil {
log.Fatal(err)
}
}

func configureLogger(format string) {
util.Colorize = false
Expand Down
3 changes: 1 addition & 2 deletions cmd/rr/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func stopHandler(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer client.Close()

util.Printf("<green>Stopping RoadRunner</reset>: ")

Expand All @@ -48,5 +47,5 @@ func stopHandler(cmd *cobra.Command, args []string) error {
}

util.Printf("<green+hb>done</reset>\n")
return nil
return client.Close()
}
4 changes: 2 additions & 2 deletions service/rpc/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ func Test_Serve_Client(t *testing.T) {
assert.NoError(t, s.Register("test", &testService{}))

go func() { assert.NoError(t, s.Serve()) }()
time.Sleep(time.Millisecond)
time.Sleep(time.Second)

client, err := s.Client()
assert.NotNil(t, client)
assert.NoError(t, err)
defer client.Close()

var resp string
assert.NoError(t, client.Call("test.Echo", "hello world", &resp))
assert.Equal(t, "hello world", resp)
assert.NoError(t, client.Close())
}

func TestSetEnv(t *testing.T) {
Expand Down

0 comments on commit 691e937

Please sign in to comment.