Closed pankajroark closed 8 years ago
Not sure why test failed on travis-ci for scala 2.11.7. The same test passes for me locally with scala 2.11.7.
Yeah, it's not related to your changes, I have the same problem in #286
Thanks @pankajroark test failure seems totally unrelated, so I'll merge.
The root cause is that pattern match on a stream evaluates both head and tail. So in: def findT(pred: T => Boolean): Future[T] = futures match { case Stream.Empty => Future.exception(new RuntimeException("Empty iterator in FutureOps.find")) case last #:: Stream.Empty => last case next #:: rest => next.filter(pred).rescue { case _: Throwable => find(rest)(pred) } }
when the second case is hit i.e. " case last #:: Stream.Empty => last" it evaluates the tail, resulting in a call to the second store.
Fixed by eliminating the use of pattern match.