Skip to content

Commit

Permalink
re-index games from secondary DB
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Mar 18, 2016
1 parent 9eea993 commit 6a4ab76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/gameSearch/src/main/GameSearchApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ final class GameSearchApi(client: ESClient) extends SearchReadApi[Game, Query] {
private def doIndex(client: ESClientHttp, since: DateTime): Funit = {
import lila.game.BSONHandlers._
import lila.db.BSON.BSONJodaDateTimeHandler
import reactivemongo.api._
import reactivemongo.bson._
var nbSkipped = 0
val batchSize = 1000
Expand All @@ -108,7 +109,7 @@ final class GameSearchApi(client: ESClient) extends SearchReadApi[Game, Query] {
lila.game.tube.gameTube.coll.find(BSONDocument(
"ca" -> BSONDocument("$gt" -> since)
)).sort(BSONDocument("ca" -> 1))
.cursor[Game]()
.cursor[Game](ReadPreference.secondaryPreferred)
.enumerate(maxGames, stopOnError = true) &>
Enumeratee.grouped(Iteratee takeUpTo batchSize) |>>>
Enumeratee.mapM[Seq[Game]].apply[(Seq[Game], Set[String])] { games =>
Expand Down

0 comments on commit 6a4ab76

Please sign in to comment.