From 735ec945914e1a1e93ebbcf7a68f29b7179e7903 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Thu, 31 May 2012 14:09:50 +1000 Subject: [PATCH] misc/dashboard/app: add debug logging to notifyOnFailure; remove unused Result.OK function R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/6258064 --- misc/dashboard/app/build/build.go | 9 --------- misc/dashboard/app/build/notify.go | 14 +++++++++----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/misc/dashboard/app/build/build.go b/misc/dashboard/app/build/build.go index fa3fe299b8..52f9fb0d4a 100644 --- a/misc/dashboard/app/build/build.go +++ b/misc/dashboard/app/build/build.go @@ -168,15 +168,6 @@ func partsToHash(c *Commit, p []string) *Result { } } -// OK returns the Commit's build state for a specific builder and goHash. -func (c *Commit) OK(builder, goHash string) (ok, present bool) { - r := c.Result(builder, goHash) - if r == nil { - return false, false - } - return r.OK, true -} - // A Result describes a build result for a Commit on an OS/architecture. // // Each Result entity is a descendant of its associated Commit entity. diff --git a/misc/dashboard/app/build/notify.go b/misc/dashboard/app/build/notify.go index e02344ca82..f4c6733598 100644 --- a/misc/dashboard/app/build/notify.go +++ b/misc/dashboard/app/build/notify.go @@ -37,12 +37,12 @@ func notifyOnFailure(c appengine.Context, com *Commit, builder string) error { p := &Package{Path: com.PackagePath} var broken *Commit - ok, present := com.OK(builder, "") - if !present { + cr := com.Result(builder, "") + if cr == nil { return fmt.Errorf("no result for %s/%s", com.Hash, builder) } q := datastore.NewQuery("Commit").Ancestor(p.Key(c)) - if ok { + if cr.OK { // This commit is OK. Notify if next Commit is broken. next := new(Commit) q.Filter("ParentHash=", com.Hash) @@ -53,7 +53,9 @@ func notifyOnFailure(c appengine.Context, com *Commit, builder string) error { } return err } - if ok, present := next.OK(builder, ""); present && !ok { + if nr := next.Result(builder, ""); nr != nil && !nr.OK { + c.Debugf("commit ok: %#v\nresult: %#v", com, cr) + c.Debugf("next commit broken: %#v\nnext result:%#v", next, nr) broken = next } } else { @@ -68,7 +70,9 @@ func notifyOnFailure(c appengine.Context, com *Commit, builder string) error { } return err } - if ok, present := prev.OK(builder, ""); present && ok { + if pr := prev.Result(builder, ""); pr != nil && pr.OK { + c.Debugf("commit broken: %#v\nresult: %#v", com, cr) + c.Debugf("previous commit ok: %#v\nprevious result:%#v", prev, pr) broken = com } } -- 2.48.1