Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
DrWrong committed Jun 1, 2018
1 parent 41639e9 commit a34947d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
12 changes: 2 additions & 10 deletions bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"

"git.apache.org/thrift.git/lib/go/thrift"
"github.com/DrWrong/monica/config"
"github.com/DrWrong/monica/logger"
"github.com/DrWrong/monica/thriftext"
Expand Down Expand Up @@ -90,7 +91,7 @@ func BootStrapWeb(postInitFunc func()) {
WebServer.Run()
}

// 起动thrift server
// BooststrapThrift 起动thrift server
func BootstrapThrift(processor thrift.TProcessor) {
port, err := config.Int("serverport")
if err != nil {
Expand All @@ -115,12 +116,3 @@ func BootstrapThriftWithPort(processor thrift.TProcessor, port int) {
}

}

func StartDm303WhenNeccssary() {
config, err := config.Map("dm303")
if err != nil {
return
}

go dm303_go.Start(config["port"].(int), config["service_name"].(string))
}
3 changes: 0 additions & 3 deletions bootstrap_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ func (app *MonicaApp) cliContextRedayHook(c *cli.Context) error {
if app.daemon {
app.writePidFile()
}
if app.globalConfigInited {
StartDm303WhenNeccssary()
}
go app.handleSigIntAndTerm()
return nil
}
Expand Down
18 changes: 18 additions & 0 deletions example/none_daemon.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"fmt"
"os"

"github.com/DrWrong/monica"
cli "gopkg.in/urfave/cli.v2"
)

func main() {
app := monica.App
app.Action = func(c *cli.Context) error {
fmt.Println("Hello word")
return nil
}
app.Run(os.Args)
}
2 changes: 1 addition & 1 deletion thriftext/thrift_client_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (p *Pool) newThriftClient() (thriftClient ThriftClient, err error) {
if err != nil {
continue
}
transport = transportFactory.GetTransport(transport)
transport, _ = transportFactory.GetTransport(transport)
err = transport.Open()
if err == nil {
break
Expand Down

0 comments on commit a34947d

Please sign in to comment.