further bug fixes

This commit is contained in:
Jörg Thalheim 2016-04-22 14:02:33 +00:00
parent 5d48af9013
commit 9d112511dd
2 changed files with 7 additions and 4 deletions

View File

@ -152,7 +152,7 @@ func (h *Handler) evaluateWhen(p *udf.Point) (bool, error) {
if err != nil {
return false, fmt.Errorf("the expression `when` should evaluate to true or false, got %s", res)
}
h.debug("evaluate '%s' for '%v' -> should scale: %s", h.When, fields, doScale)
h.debug("evaluate '%s' for '%v' -> should scale: %v", h.When, fields, doScale)
return doScale, nil
}
@ -191,6 +191,9 @@ func (h *Handler) Point(p *udf.Point) error {
if err != nil {
return err
}
if to == service.CurrentInstances {
h.debug("skip scaling service '%s' still %d", h.Id, to)
}
h.debug("attempt to scale service '%s' from %d to %d", h.Id, service.CurrentInstances, to)
if !h.Simulate {
err = h.scaleAgent.Scale(h.Id, to)
@ -200,9 +203,9 @@ func (h *Handler) Point(p *udf.Point) error {
}
service.CurrentInstances = to
service.CooldownUntil = time.Now().Add(h.Cooldown)
p.FieldsDouble = nil
p.FieldsDouble = make(map[string]float64)
p.FieldsInt = map[string]int64{"scale": to}
p.FieldsString = nil
p.FieldsString = make(map[string]string)
h.kapacitorAgent.Responses <- &udf.Response{
Message: &udf.Response_Point{
Point: p,

View File

@ -47,7 +47,7 @@ func (acc *acceptor) Accept(conn net.Conn) {
func parseArgs() *url.URL {
flag.Parse()
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "USAGE: %s rancherurl\n")
fmt.Fprintf(os.Stderr, "USAGE: %s rancherurl\n", os.Args[0])
fmt.Fprintf(os.Stderr, "rancher url is expected as first argument, for example: http://accesskey:secretkey@localhost:8080")
os.Exit(1)
}