Akka HTTP: Blocking in a future blocks the server
<p>I am trying to use Akka HTTP to basic authenticate my request.
It so happens that I have an external resource to authenticate through, so I have to make a rest call to this resource.</p>

<p>This takes some time, and while it's processing, it seems the rest of my API is blocked, waiting for this call.
I have reproduced this with a very simple example:</p>

<pre><code>// used dispatcher:
implicit val system = ActorSystem()
implicit val executor = system.dispatcher
implicit val materializer = ActorMaterializer()


val routes = 
  (post &amp; entity(as[String])) { e =&gt;
    complete {
      Future{
        Thread.sleep(5000)
        e
      }
    }
  } ~
  (get &amp; path(Segment)) { r =&gt;
    complete {
      "get"
    }
  }
</code></pre>

<p>If I post to the log endpoint, my get endpoint is also stuck waiting for the 5 seconds, which the log endpoint dictated.</p>

<p>Is this expected behaviour, and if is, how do I make blocking operations without blocking my entire API?</p>