I have list of futures and Await
val listWithResult = Await.result(Future.sequence(listOfFutures), 10.minutes)
It fails with
java.util.concurrent.TimeoutException: Futures timed out after [10 minutes]
- Is there any technique to figure out which future did not complete on time?
- Its there any way to attribute such future with extra metadata to give a clue why it did not complete on time?
Each future submits task and polls polls external service for result. I would like to show that task in stacktrace somehow.
Well, you can figure out what didn't complete fairly easily with something like
listOfFutures.filterNot(_.isCompleted).(also, keep in mind, that
Awaitis code smell and in vast majority of cases, really not what you want to do).As to "why", I don't think there is any universal advice here, aside for the usual: logging, metrics, tracing ..