Skip to content

Commit

Permalink
Merge pull request #39 from disneystreaming/shutdown-timeout
Browse files Browse the repository at this point in the history
Add shutdown timeout
  • Loading branch information
Baccata authored Sep 8, 2023
2 parents 6bf1de0 + f0852fa commit f93a2c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/g8/src/main/scala/com/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.http4s.ember.server._
import org.http4s._
import com.comcast.ip4s._
import smithy4s.http4s.SimpleRestJsonBuilder
import scala.concurrent.duration._

object HelloWorldImpl extends HelloWorldService[IO] {
def hello(name: String, town: Option[String]): IO[Greeting] = IO.pure {
Expand Down Expand Up @@ -42,11 +43,11 @@ object Main extends IOApp.Simple {
.withPort(thePort)
.withHost(theHost)
.withHttpApp(routes.orNotFound)
.withShutdownTimeout(1.second)
.build
.productL(IO.println(message).toResource)
}
.useForever
.race(IO.readLine)
.surround(IO.readLine)
.void
.guarantee(IO.println("Goodbye!"))

Expand Down

0 comments on commit f93a2c8

Please sign in to comment.