summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-02-17 12:18:51 +0300
committerGitHub <[email protected]>2020-02-17 12:18:51 +0300
commit691e937bcaf089e33e11e7f5528e7e736f500d0a (patch)
tree63a3e2dd75635cd461dec4f44a87936c9d42db42
parent54ca82d7591a93fcea25951e502134243258a4b1 (diff)
parent024807789ee7b493aaa0e9d71c27eea32f2f64fa (diff)
Merge pull request #250 from spiral/rr_1.6.1v1.6.1
release 1.6.1
-rw-r--r--.gitignore2
-rwxr-xr-xbuild.sh2
-rw-r--r--cmd/rr/cmd/root.go24
-rw-r--r--cmd/rr/cmd/stop.go3
-rw-r--r--service/rpc/service_test.go4
5 files changed, 30 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 4d651033..7fb2cf09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,5 @@ composer.lock
vendor
builds/
tests/vendor/
-.rr.yaml
+.rr-sample.yaml
psr-worker.php \ No newline at end of file
diff --git a/build.sh b/build.sh
index 2ca858e2..8015a481 100755
--- a/build.sh
+++ b/build.sh
@@ -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
diff --git a/cmd/rr/cmd/root.go b/cmd/rr/cmd/root.go
index 515e6419..456cfc6a 100644
--- a/cmd/rr/cmd/root.go
+++ b/cmd/rr/cmd/root.go
@@ -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"
)
@@ -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
diff --git a/cmd/rr/cmd/stop.go b/cmd/rr/cmd/stop.go
index 8beee73e..7b4794e7 100644
--- a/cmd/rr/cmd/stop.go
+++ b/cmd/rr/cmd/stop.go
@@ -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>: ")
@@ -48,5 +47,5 @@ func stopHandler(cmd *cobra.Command, args []string) error {
}
util.Printf("<green+hb>done</reset>\n")
- return nil
+ return client.Close()
}
diff --git a/service/rpc/service_test.go b/service/rpc/service_test.go
index ee87509a..11e8fcb5 100644
--- a/service/rpc/service_test.go
+++ b/service/rpc/service_test.go
@@ -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) {