Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 package common | 1 package common |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "fmt" | 4 "fmt" |
| 5 "time" | 5 "time" |
| 6 | 6 |
| 7 "github.com/skia-dev/glog" | 7 "github.com/skia-dev/glog" |
| 8 "go.skia.org/infra/fuzzer/go/config" | |
| 8 "go.skia.org/infra/go/vcsinfo" | 9 "go.skia.org/infra/go/vcsinfo" |
| 9 "google.golang.org/cloud/storage" | 10 "google.golang.org/cloud/storage" |
| 10 ) | 11 ) |
| 11 | 12 |
| 12 // A VersionHandler is the type of the callbacks used by VersionWatcher. | 13 // A VersionHandler is the type of the callbacks used by VersionWatcher. |
| 13 // The callbacks should return the vcsinfo.LongCommit of the new version | 14 // The callbacks should return the vcsinfo.LongCommit of the new version |
| 14 // to be used by other dependents on this VersionHandler. | 15 // to be used by other dependents on this VersionHandler. |
| 15 type VersionHandler func(string) (*vcsinfo.LongCommit, error) | 16 type VersionHandler func(string) (*vcsinfo.LongCommit, error) |
| 16 | 17 |
| 17 // VersionWatcher handles the logic to wait for the version under fuzz to change in | 18 // VersionWatcher handles the logic to wait for the version under fuzz to change in |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 glog.Infof("Calling onCurrentChange(%q)", curren t) | 72 glog.Infof("Calling onCurrentChange(%q)", curren t) |
| 72 cv, err := vw.onCurrentChange(current) | 73 cv, err := vw.onCurrentChange(current) |
| 73 if err != nil { | 74 if err != nil { |
| 74 vw.Status <- fmt.Errorf("Failed while ex ecuting onCurrentChange %#v.We could be in a broken state. %s", vw.onCurrentChan ge, err) | 75 vw.Status <- fmt.Errorf("Failed while ex ecuting onCurrentChange %#v.We could be in a broken state. %s", vw.onCurrentChan ge, err) |
| 75 return | 76 return |
| 76 } | 77 } |
| 77 vw.CurrentVersion = cv | 78 vw.CurrentVersion = cv |
| 78 vw.lastCurrentHash = current | 79 vw.lastCurrentHash = current |
| 79 } | 80 } |
| 80 | 81 |
| 82 if config.Common.ForceReanalysis { | |
| 83 if _, err := vw.onPendingChange(vw.lastCurrentHa sh); err != nil { | |
| 84 glog.Errorf("There was a problem during force analysis: %s", err) | |
| 85 } | |
| 86 config.Common.ForceReanalysis = false | |
|
jcgregorio
2016/02/05 20:37:19
Will this ever get turned back on?
kjlubick
2016/02/05 20:41:02
No. It's only set by the command flag.
| |
| 87 return | |
| 88 } | |
| 89 | |
| 81 pending, err := GetPendingSkiaVersionFromGCS(vw.storageC lient) | 90 pending, err := GetPendingSkiaVersionFromGCS(vw.storageC lient) |
| 82 if err != nil { | 91 if err != nil { |
| 83 glog.Errorf("Failed getting pending Skia version from GCS. Going to try again: %s", err) | 92 glog.Errorf("Failed getting pending Skia version from GCS. Going to try again: %s", err) |
| 84 continue | 93 continue |
| 85 } | 94 } |
| 86 glog.Infof("Pending version found to be %q", pending) | 95 glog.Infof("Pending version found to be %q", pending) |
| 87 if pending == "" { | 96 if pending == "" { |
| 88 vw.lastPendingHash = "" | 97 vw.lastPendingHash = "" |
| 89 vw.PendingVersion = nil | 98 vw.PendingVersion = nil |
| 90 } else if vw.lastPendingHash != pending && vw.onPendingC hange != nil { | 99 } else if vw.lastPendingHash != pending && vw.onPendingC hange != nil { |
| 91 glog.Infof("Calling onPendingChange(%q)", pendin g) | 100 glog.Infof("Calling onPendingChange(%q)", pendin g) |
| 92 pv, err := vw.onPendingChange(pending) | 101 pv, err := vw.onPendingChange(pending) |
| 93 if err != nil { | 102 if err != nil { |
| 94 vw.Status <- fmt.Errorf("Failed while ex ecuting onCurrentChange %#v.We could be in a broken state. %s", vw.onCurrentChan ge, err) | 103 vw.Status <- fmt.Errorf("Failed while ex ecuting onCurrentChange %#v.We could be in a broken state. %s", vw.onCurrentChan ge, err) |
| 95 return | 104 return |
| 96 } | 105 } |
| 97 vw.PendingVersion = pv | 106 vw.PendingVersion = pv |
| 98 vw.lastPendingHash = pending | 107 vw.lastPendingHash = pending |
| 99 } | 108 } |
| 100 } | 109 } |
| 101 }() | 110 }() |
| 102 } | 111 } |
| OLD | NEW |