май, это может вам помочь
/** Asynchronously processes the value in the future once the value becomes available.
*
* WARNING: Will not be called if this future is never completed or if it is completed with a failure.
*
* $swallowsExceptions
*
* @tparam U only used to accept any return type of the given callback function
* @param f the function which will be executed if this `Future` completes with a result,
* the return value of `f` will be discarded.
* @group Callbacks
*/
def foreach[U](f: T => U)(implicit executor: ExecutionContext): Unit = onComplete { _ foreach f }
эта foreach документация по признаку Future, внутренний foreach вызывается из scala.util.Try.foreach
и есть его заявление.
/**
* Applies the given function `f` if this is a `Success`, otherwise returns `Unit` if this is a `Failure`.
*
* ''Note:'' If `f` throws, then this method may throw an exception.
*/
def foreach[U](f: T => U): Unit
это самое главное.
* ПРЕДУПРЕЖДЕНИЕ: не будет вызвано, если это будущее никогда не завершается или если оно завершается с ошибкой.