in storehaus-core/src/main/scala/com/twitter/storehaus/RetryingStore.scala [30:46]
private[this] def getWithRetry(k: K, backoffs: Iterable[Duration]): Future[Option[V]] =
store.get(k).filter(pred) transform {
case Return(t) => Future.value(t)
case Throw(e) =>
backoffs.headOption match {
case None => FutureOps.retriesExhaustedFor(k)
case Some(interval) => interval match {
case Duration.Zero => getWithRetry(k, backoffs.tail)
case Duration.Top => FutureOps.missingValueFor(k)
case _ => Futures.flatten {
timer.doLater(interval) {
getWithRetry(k, backoffs.tail)
}
}
}
}
}