Skip to content

Instantly share code, notes, and snippets.

@atamborrino
Created March 23, 2014 20:27
Show Gist options
  • Save atamborrino/9729337 to your computer and use it in GitHub Desktop.
Save atamborrino/9729337 to your computer and use it in GitHub Desktop.
import play.api.libs.iteratee._
import play.api.libs.iteratee.Enumerator._
import concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.concurrent.duration._
implicit val t = 100 seconds
def startStream(): Future[Iteratee[Event, Unit]] = {
Thread.sleep(1000)
(Iteratee.foreach[Event] { e =>
println("error")
throw new RuntimeException("")
}).feed(Input.El(Event(PathId(0))))
}
def loopRestart(futIt: Future[Iteratee[Event, Unit]]): Future[Iteratee[Event, Unit]] = {
futIt flatMap { _ =>
// get lastId...
println("restart")
loopRestart(startStream())
}
}
loopRestart(startStream())
Thread.sleep(100000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment