logger.Debugf("LIFECYCLE WATCHER %v HAS VALUES %v", w.collName, values)
select {
case <-w.tomb.Dying():
return tomb.ErrDying
case <-w.st.watcher.Dead():
return stateWatcherDeadError(w.st.watcher.Err())
case ch := <-in:
// TODO(mue) Remove after debugging!
logger.Debugf("LIFECYCLE WATCHER %v RECEIVED %v", w.collName, ch)
updates, ok := collect(ch, in, w.tomb.Dying())
// TODO(mue) Remove after debugging!
logger.Debugf("LIFECYCLE WATCHER %v HAS UPDATES %v", w.collName, updates)
if !ok {
return tomb.ErrDying
}
if err := w.merge(ids, updates); err != nil {
return err
}
// TODO(mue) Remove after debugging!
logger.Debugf("LIFECYCLE WATCHER %v IDS ARE %v", w.collName, ids)
if !ids.IsEmpty() {
out = w.out
}
case out <- values:
// TODO(mue) Remove after debugging!
logger.Debugf("LIFECYCLE WATCHER %v SENT %v", w.collName, values)
ids = make(set.Strings)
out = nil
}