Skip to content

Commit

Permalink
avoid contention of parser's monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSumislawski committed Apr 18, 2021
1 parent e180c8a commit 854938a
Showing 1 changed file with 9 additions and 7 deletions.
Expand Up @@ -201,14 +201,16 @@ private[blaze] class Http1ServerStage[F[_]](
.recoverWith(serviceErrorHandler(req))
.flatMap(resp => F.delay(renderResponse(req, resp, cleanup)))

val theCancelToken = Some(
F.runCancelable(action) {
case Right(()) => IO.unit
case Left(t) =>
IO(logger.error(t)(s"Error running request: $req")).attempt *> IO(
closeConnection())
}.unsafeRunSync())

parser.synchronized {
cancelToken = Some(
F.runCancelable(action) {
case Right(()) => IO.unit
case Left(t) =>
IO(logger.error(t)(s"Error running request: $req")).attempt *> IO(
closeConnection())
}.unsafeRunSync())
cancelToken = theCancelToken
}
}
})
Expand Down

0 comments on commit 854938a

Please sign in to comment.