Skip to content

Commit

Permalink
internal/core/adt: restrict notification
Browse files Browse the repository at this point in the history
This restricts the cases where notifications are added,
limiting the overhead of the mechanism.

Issue #661

Change-Id: I4d8929dfb6136ef994e39eb50c1ede39c2f13f60
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8402
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Jan 29, 2021
1 parent d2aa995 commit 0ad02fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ Result:
// ./in.cue:2:5
// ./in.cue:5:7
}
y: (_|_){
// [eval] a.x: conflicting values "hey!?" and "hey":
// ./in.cue:2:5
// ./in.cue:5:7
}
y: (string){ "hey!" }
}
}
9 changes: 8 additions & 1 deletion internal/core/adt/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,14 @@ func (c *OpContext) evaluate(v *Vertex, state VertexStatus) Value {
}

if v.status < Finalized && v.state != nil {
v.state.addNotify(c.vertex)
// TODO: errors are slightly better if we always add addNotify, but
// in this case it is less likely to cause a performance penalty.
// See https://github.com/cuelang/cue/issues/661. It may be possible to
// relax this again once we have proper tests to prevent regressions of
// that issue.
if !v.state.done() || v.state.errs != nil {
v.state.addNotify(c.vertex)
}
}

return v
Expand Down

0 comments on commit 0ad02fd

Please sign in to comment.