Skip to content

Commit 691e937

Browse files
authored
Merge pull request #250 from spiral/rr_1.6.1
release 1.6.1
2 parents 54ca82d + 0248077 commit 691e937

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ composer.lock
33
vendor
44
builds/
55
tests/vendor/
6-
.rr.yaml
6+
.rr-sample.yaml
77
psr-worker.php

build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ RR_VERSION=1.6.0
88
# Hardcode some values to the core package
99
LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.Version=${RR_VERSION}"
1010
LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.BuildTime=$(date +%FT%T%z)"
11+
# remove debug info from binary as well as string and symbol tables
12+
LDFLAGS="$LDFLAGS -s"
1113

1214
build(){
1315
echo Packaging $1 Build

cmd/rr/cmd/root.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ import (
2626
"github.com/spiral/roadrunner/cmd/util"
2727
"github.com/spiral/roadrunner/service"
2828
"github.com/spiral/roadrunner/service/limit"
29+
"log"
30+
"net/http"
31+
"net/http/pprof"
2932
"os"
3033
)
3134

@@ -116,8 +119,29 @@ func init() {
116119
})
117120
}
118121
}
122+
123+
// if debug --> also run pprof service
124+
if Debug {
125+
go runDebugServer()
126+
}
119127
})
120128
}
129+
func runDebugServer() {
130+
mux := http.NewServeMux()
131+
mux.HandleFunc("/debug/pprof/", pprof.Index)
132+
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
133+
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
134+
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
135+
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
136+
srv := http.Server{
137+
Addr: ":6061",
138+
Handler: mux,
139+
}
140+
141+
if err := srv.ListenAndServe(); err != nil {
142+
log.Fatal(err)
143+
}
144+
}
121145

122146
func configureLogger(format string) {
123147
util.Colorize = false

cmd/rr/cmd/stop.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func stopHandler(cmd *cobra.Command, args []string) error {
3838
if err != nil {
3939
return err
4040
}
41-
defer client.Close()
4241

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

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

5049
util.Printf("<green+hb>done</reset>\n")
51-
return nil
50+
return client.Close()
5251
}

service/rpc/service_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ func Test_Serve_Client(t *testing.T) {
7171
assert.NoError(t, s.Register("test", &testService{}))
7272

7373
go func() { assert.NoError(t, s.Serve()) }()
74-
time.Sleep(time.Millisecond)
74+
time.Sleep(time.Second)
7575

7676
client, err := s.Client()
7777
assert.NotNil(t, client)
7878
assert.NoError(t, err)
79-
defer client.Close()
8079

8180
var resp string
8281
assert.NoError(t, client.Call("test.Echo", "hello world", &resp))
8382
assert.Equal(t, "hello world", resp)
83+
assert.NoError(t, client.Close())
8484
}
8585

8686
func TestSetEnv(t *testing.T) {

0 commit comments

Comments
 (0)