Skip to content

Commit

Permalink
Optimize Runloop::handleRequests code (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii authored Feb 27, 2023
1 parent 2d1ddd1 commit 2b7c028
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,8 @@ private[consumer] final class Runloop(
onFalse = consumer
.withConsumer(_.assignment.asScala)
.flatMap { assignment =>
ZIO.foldLeft(reqs)(state) { (state, req) =>
if (assignment.contains(req.tp))
ZIO.succeed(state.addRequest(req))
else
req.end.as(state)
}
val (toQueue, toEnd) = reqs.partition(req => assignment.contains(req.tp))
ZIO.foreach(toEnd)(_.end).as(state.addRequests(toQueue))
}
.orElseSucceed(state.addRequests(reqs))
)
Expand Down

0 comments on commit 2b7c028

Please sign in to comment.