This repository was archived by the owner on Mar 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed
core/src/main/scala/fr/davit/akka/http/metrics/core/scaladsl/server Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Unreleased
4+
5+ - Fix implicit execution context regression
6+
37## 1.1.0 (2020-04-18)
48
59- Fix implicits for HTTP/2 API
Original file line number Diff line number Diff line change @@ -56,15 +56,22 @@ final class HttpMetricsRoute private (route: Route) extends HttpMetricsDirective
5656 executionContext : ExecutionContextExecutor = null ,
5757 rejectionHandler : RejectionHandler = RejectionHandler .default,
5858 exceptionHandler : ExceptionHandler = null
59- ): Flow [HttpRequest , HttpResponse , NotUsed ] =
60- Flow [HttpRequest ]
61- .mapAsync(1 )(recordMetricsAsync(metricsHandler))
62- .watchTermination() {
63- case (mat, completion) =>
64- // every connection materializes a stream
65- metricsHandler.onConnection(completion)
66- mat
67- }
59+ ): Flow [HttpRequest , HttpResponse , NotUsed ] = {
60+ val effectiveEC = if (executionContext ne null ) executionContext else materializer.executionContext
61+
62+ {
63+ // override the execution context passed as parameter
64+ implicit val executionContext : ExecutionContextExecutor = effectiveEC
65+ Flow [HttpRequest ]
66+ .mapAsync(1 )(recordMetricsAsync(metricsHandler))
67+ .watchTermination() {
68+ case (mat, completion) =>
69+ // every connection materializes a stream.
70+ metricsHandler.onConnection(completion)
71+ mat
72+ }
73+ }
74+ }
6875
6976 def recordMetricsAsync (metricsHandler : HttpMetricsHandler )(
7077 implicit
You can’t perform that action at this time.
0 commit comments