adding fork := true for backend server interrupts
without it app starts in same jvm and we're told that Ctrl+C will not always kill the Ember server: https://typelevel.org/cats-effect/docs/2.x/datatypes/ioapp WARNING: If you run your IOApp program from sbt, you may observe cancellation and resource releasing is not happening. This is due to sbt, by default, running programs in the same JVM as sbt, so when your program is canceled sbt avoids stopping its own JVM. To properly allow cancellation, ensure your progam is forked into its own JVM via a setting like fork := true in your sbt configuration.
This commit is contained in:
parent
77b34a2ca7
commit
8716385ea1
|
@ -6,9 +6,9 @@ import com.comcast.ip4s._
|
|||
import org.http4s.ember.server._
|
||||
import fs2._
|
||||
|
||||
object BackendApp extends IOApp.Simple {
|
||||
object BackendApp extends IOApp {
|
||||
|
||||
override def run: IO[Unit] = {
|
||||
override def run(args: List[String]): IO[ExitCode] = {
|
||||
val host = host"0.0.0.0"
|
||||
val port = port"8080"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ object MyHttpService {
|
|||
val send: Stream[IO, WebSocketFrame] =
|
||||
Stream
|
||||
.emits(TestModels.testChangesList)
|
||||
.covary[IO].metered(2.second).map(state => WebSocketFrame.Text(state.asJson.noSpaces))
|
||||
.covary[IO].metered(1.second).map(state => WebSocketFrame.Text(state.asJson.noSpaces))
|
||||
|
||||
val receive: Pipe[IO, WebSocketFrame, Unit] = _.evalMap {
|
||||
case WebSocketFrame.Text(text, _) => Sync[IO].delay(println(text))
|
||||
|
|
Loading…
Reference in New Issue