Created
March 23, 2014 20:27
-
-
Save atamborrino/9729337 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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