Skip to content

Commit

Permalink
Lisää lokitusta hakemusten hakemiseen YTL-ajossa.
Browse files Browse the repository at this point in the history
  • Loading branch information
augustk committed Apr 2, 2024
1 parent 2a97bd9 commit e088b89
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,19 @@ class YtlIntegration(
.map(_.flatten)
}

hakuOids.grouped(10).foldLeft(Future.successful(Set.empty[HetuPersonOid])) {
case (result, chunk) => result.flatMap(rs => fetchChunk(chunk).map(rs ++ _))
}
val hakuOidsChunkSize = 10
hakuOids.zipWithIndex
.grouped(hakuOidsChunkSize)
.foldLeft(Future.successful(Set.empty[HetuPersonOid])) {
case (result, chunkWithIndex) => {
val chunk = chunkWithIndex.map(_._1)
val firstIndex = chunkWithIndex.map(_._2).head
logger.info(
s"Fetching hakuOid chunk. First hakuOid is ${firstIndex}/${hakuOids.size} (Chunk size is ${hakuOidsChunkSize} and hakuOids are ${chunk})"
)
result.flatMap(rs => fetchChunk(chunk).map(rs ++ _))
}
}
}

logger.info(s"Fetching in chunks, activeKKHakuOids: ${activeKKHakuOids.get()}")
Expand Down

0 comments on commit e088b89

Please sign in to comment.