Skip to content

Commit

Permalink
compress bulk payloads and increase batch sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Sep 2, 2015
1 parent 11a2625 commit d29254f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/forumSearch/src/main/ForumSearchApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class ForumSearchApi(
def reset = client.putMapping >> {
import lila.db.api._
import lila.forum.tube.postTube
$enumerate.bulk[Option[Post]]($query[Post](Json.obj()), 200) { postOptions =>
$enumerate.bulk[Option[Post]]($query[Post](Json.obj()), 500) { postOptions =>
(postApi liteViews postOptions.flatten) flatMap { views =>
client.storeBulk(views map (v => Id(v.post.id) -> toDoc(v)))
}
Expand Down
2 changes: 1 addition & 1 deletion modules/gameSearch/src/main/GameSearchApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class GameSearchApi(client: ESClient) extends SearchReadApi[Game, Query] {
var started = nowMillis
for {
size <- $count($select.all)
batchSize = 1000
batchSize = 2000
limit = Int.MaxValue
_ <- $enumerate.bulk[Option[Game]]($query.all, batchSize, limit) { gameOptions =>
val games = gameOptions.flatten filter storable
Expand Down
2 changes: 1 addition & 1 deletion modules/teamSearch/src/main/TeamSearchApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class TeamSearchApi(
def reset = client.putMapping >> {
import lila.db.api._
import lila.team.tube.teamTube
$enumerate.bulk[Option[Team]]($query[Team](Json.obj("enabled" -> true)), 100) { teamOptions =>
$enumerate.bulk[Option[Team]]($query[Team](Json.obj("enabled" -> true)), 300) { teamOptions =>
client.storeBulk(teamOptions.flatten map (t => Id(t.id) -> toDoc(t)))
}
}
Expand Down

0 comments on commit d29254f

Please sign in to comment.