Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions solver/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ func (e *edge) finishIncoming(req pipe.Sender) {

// updateIncoming updates the current value of incoming pipe request
func (e *edge) updateIncoming(req pipe.Sender) {
if debugScheduler {
logrus.Debugf("updateIncoming %s %#v desired=%s", e.edge.Vertex.Name(), e.edgeState, req.Request().Payload.(*edgeRequest).desiredState)
}
req.Update(&e.edgeState)
}

Expand Down
14 changes: 9 additions & 5 deletions solver/internal/pipe/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ import (
type channel struct {
OnSendCompletion func()
value atomic.Value
lastValue interface{}
lastValue *wrappedValue
}

type wrappedValue struct {
value interface{}
}

func (c *channel) Send(v interface{}) {
c.value.Store(v)
c.value.Store(&wrappedValue{value: v})
if c.OnSendCompletion != nil {
c.OnSendCompletion()
}
}

func (c *channel) Receive() (interface{}, bool) {
v := c.value.Load()
if c.lastValue == v {
if v == nil || v.(*wrappedValue) == c.lastValue {
return nil, false
}
c.lastValue = v
return v, true
c.lastValue = v.(*wrappedValue)
return v.(*wrappedValue).value, true
}

type Pipe struct {
Expand Down