Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: dm/appengine/deps/walk_graph.go

Issue 2344893010: Fix walk graph to recurse correctly. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dm/appengine/deps/walk_graph_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/appengine/deps/walk_graph.go
diff --git a/dm/appengine/deps/walk_graph.go b/dm/appengine/deps/walk_graph.go
index e6179b9ccf40945db8334986388d1e8721a7675c..f35d9508830517798dc40b0eed1c7c6f5c709731 100644
--- a/dm/appengine/deps/walk_graph.go
+++ b/dm/appengine/deps/walk_graph.go
@@ -294,7 +294,7 @@ func (g *graphWalker) attemptLoader(aid *dm.Attempt_ID, authedForResult bool, ds
writeFwd := g.req.Include.FwdDeps
walkFwd := (g.req.Mode.Direction == dm.WalkGraphReq_Mode_BOTH ||
- g.req.Mode.Direction == dm.WalkGraphReq_Mode_FORWARDS)
+ g.req.Mode.Direction == dm.WalkGraphReq_Mode_FORWARDS) && send != nil
loadFwd := writeFwd || walkFwd
if loadFwd {
@@ -318,7 +318,7 @@ func (g *graphWalker) attemptLoader(aid *dm.Attempt_ID, authedForResult bool, ds
writeBack := g.req.Include.BackDeps
walkBack := (g.req.Mode.Direction == dm.WalkGraphReq_Mode_BOTH ||
- g.req.Mode.Direction == dm.WalkGraphReq_Mode_BACKWARDS)
+ g.req.Mode.Direction == dm.WalkGraphReq_Mode_BACKWARDS) && send != nil
loadBack := writeBack || walkBack
if loadBack {
@@ -441,6 +441,9 @@ func doGraphWalk(c context.Context, req *dm.WalkGraphReq) (rsp *dm.GraphData, er
g := graphWalker{Context: c, req: req}
sendNodeAuthed := func(depth int64) func(*dm.Attempt_ID, bool) error {
+ if req.Limit.MaxDepth != -1 && depth > req.Limit.MaxDepth {
+ return nil
+ }
return func(aid *dm.Attempt_ID, isAuthed bool) error {
select {
case nodeChan <- &node{aid: aid, depth: depth, canSeeAttemptResult: isAuthed}:
@@ -540,7 +543,7 @@ func doGraphWalk(c context.Context, req *dm.WalkGraphReq) (rsp *dm.GraphData, er
atmpt.Id = n.aid
}
qst.Attempts[n.aid.Id] = atmpt
- if req.Limit.MaxDepth == -1 || n.depth < req.Limit.MaxDepth {
+ if req.Limit.MaxDepth == -1 || n.depth <= req.Limit.MaxDepth {
addJob(g.attemptLoader(n.aid, n.canSeeAttemptResult, atmpt,
sendNodeAuthed(n.depth+1)))
}
« no previous file with comments | « no previous file | dm/appengine/deps/walk_graph_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698