Reverse the ping option
This commit is contained in:
		
							
								
								
									
										10
									
								
								cmd/cmd.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								cmd/cmd.go
									
									
									
									
									
								
							| @@ -15,6 +15,7 @@ import ( | |||||||
| 	"text/template" | 	"text/template" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
|  | 	log "github.com/golang/glog" | ||||||
| 	"github.com/codegangsta/cli" | 	"github.com/codegangsta/cli" | ||||||
| 	"github.com/micro/go-micro/broker" | 	"github.com/micro/go-micro/broker" | ||||||
| 	"github.com/micro/go-micro/client" | 	"github.com/micro/go-micro/client" | ||||||
| @@ -100,9 +101,9 @@ var ( | |||||||
| 		}, | 		}, | ||||||
|  |  | ||||||
| 		cli.BoolFlag{ | 		cli.BoolFlag{ | ||||||
| 			Name:   "disable_ping", | 			Name:   "enable_ping", | ||||||
| 			EnvVar: "MICRO_DISABLE_PING", | 			EnvVar: "MICRO_ENABLE_PING", | ||||||
| 			Usage:  "Disable ping", | 			Usage:  "Enable ping", | ||||||
| 		}, | 		}, | ||||||
|  |  | ||||||
| 		// logging flags | 		// logging flags | ||||||
| @@ -180,6 +181,7 @@ func ping() { | |||||||
| 	cl := &http.Client{} | 	cl := &http.Client{} | ||||||
|  |  | ||||||
| 	fn := func() { | 	fn := func() { | ||||||
|  | 		log.Infof("Ping micro-services.co") | ||||||
| 		p.Timestamp = time.Now().Unix() | 		p.Timestamp = time.Now().Unix() | ||||||
| 		b, err := json.Marshal(p) | 		b, err := json.Marshal(p) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @@ -255,7 +257,7 @@ func Setup(c *cli.Context) error { | |||||||
|  |  | ||||||
| 	client.DefaultClient = client.NewClient() | 	client.DefaultClient = client.NewClient() | ||||||
|  |  | ||||||
| 	if !c.Bool("disable_ping") { | 	if c.Bool("enable_ping") { | ||||||
| 		go ping() | 		go ping() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user