in src/main/scala/com/twitter/stitch/Stitch.scala [2240:2265]
override def simplify(pending: Pending): Stitch[T] = {
if (sleepStitch == null)
sleepStitch = pending.add((), SleepGroup(timeout, timer))
assert(sleepStitch != null)
sleepStitch = sleepStitch.simplify(pending)
val expired =
sleepStitch match {
case Const(_) => true
case _ => false
}
self match {
case Const(_) => self
case _ if expired => Stitch.exception(exc)
case _ =>
self = self.simplify(pending)
self match {
case Const(_) => self
case _ => this
}
}
}