Created
December 4, 2016 19:50
-
-
Save mgodave/9e096b56d141540002dc09c0e600e2d4 to your computer and use it in GitHub Desktop.
This file contains 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 com.twitter.concurrent.AsyncStream | |
import com.twitter.concurrent.AsyncStream._ | |
import com.twitter.util.{Await, Future} | |
object MapConcurrentLeak extends App{ | |
def stream(i: Int, stop: Int): AsyncStream[Int] = { | |
if (i >= stop) fromFuture(Future.never) | |
else i +:: stream(i + 1, stop) | |
} | |
Await.ready( | |
stream(0, 1000000) | |
.mapConcurrent(10)(_ => Future.Done) | |
.force | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment