score:2

Accepted answer

looks like i came to an answer.

if you have the same problem, simply call someheavycomputation from inside the complete() block, not before:

val e = get {
  path("api/endpoint" / doublenumber) {
    case (mynumberargument) {
      complete {
        val result = someheavycomputation(mynumberargument)
        httpentity(contenttypes.`application/json`, result.tostring)
      }
    }
  }
}

new processes will be launched as necessary.


Related Query

More Query from same tag