Skip to content

Commit

Permalink
Reverse the ping option
Browse files Browse the repository at this point in the history
  • Loading branch information
iheitlager committed Dec 23, 2015
1 parent 6226a80 commit d747e9b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"text/template"
"time"

log "github.com/golang/glog"
"github.com/codegangsta/cli"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/client"
Expand Down Expand Up @@ -100,9 +101,9 @@ var (
},

cli.BoolFlag{
Name: "disable_ping",
EnvVar: "MICRO_DISABLE_PING",
Usage: "Disable ping",
Name: "enable_ping",
EnvVar: "MICRO_ENABLE_PING",
Usage: "Enable ping",
},

// logging flags
Expand Down Expand Up @@ -180,6 +181,7 @@ func ping() {
cl := &http.Client{}

fn := func() {
log.Infof("Ping micro-services.co")
p.Timestamp = time.Now().Unix()
b, err := json.Marshal(p)
if err != nil {
Expand Down Expand Up @@ -255,7 +257,7 @@ func Setup(c *cli.Context) error {

client.DefaultClient = client.NewClient()

if !c.Bool("disable_ping") {
if c.Bool("enable_ping") {
go ping()
}

Expand Down

0 comments on commit d747e9b

Please sign in to comment.