瀏覽代碼

No need to generate a parallel range - will just add to the elapsed time as generating 10 futures is a short lived operation and doesn't require parallelism.

Christopher Hunt 12 年之前
父節點
當前提交
63986aab87
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      play-scala/app/controllers/Application.scala

+ 3 - 2
play-scala/app/controllers/Application.scala

@@ -25,8 +25,9 @@ object Application extends Controller {
       val random = ThreadLocalRandom.current()
 
       val worlds = Future.sequence( (for {
-        _ <- (1 to queries).par
-      } yield Future(World.findById(random.nextInt(TEST_DATABASE_ROWS) + 1))(dbEc)).toList)
+            _ <- 1 to queries
+          } yield Future(World.findById(random.nextInt(TEST_DATABASE_ROWS) + 1))(dbEc)
+        ).toList)
 
       worlds map {
         w => Ok(Json.toJson(w))