Skip to content

Commit

Permalink
udated workflow and added more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gciuloaica committed Mar 4, 2022
1 parent 7d89f28 commit 869e9fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
run: sbt ++2.13.8 doc

- name: Compress target directories
run: tar cf targets.tar target zio-http-test/target zio-http/target zio-http-benchmarks/target example/target project/target
run: tar cf targets.tar target zio-http-test/target zio-http/target zio-http-benchmarks/target zio-http-logging/target example/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
Expand Down
8 changes: 7 additions & 1 deletion zio-http/src/main/scala/zhttp/service/Handler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.netty.channel.ChannelHandler.Sharable
import io.netty.channel.{ChannelHandlerContext, SimpleChannelInboundHandler}
import io.netty.handler.codec.http._
import zhttp.http._
import zhttp.logging.Logger
import zhttp.service.server.content.handlers.ServerResponseHandler
import zhttp.service.server.{ServerTime, WebSocketUpgrade}
import zio.{UIO, ZIO}
Expand All @@ -20,8 +21,11 @@ private[zhttp] final case class Handler[R](
with WebSocketUpgrade[R]
with ServerResponseHandler[R] { self =>

private val log = Logger.getLogger("zhttp.service.Handler")

override def channelRead0(ctx: Ctx, msg: HttpObject): Unit = {

log.trace("server.Handler-channelRead0")
implicit val iCtx: ChannelHandlerContext = ctx
msg match {
case jReq: FullHttpRequest =>
Expand Down Expand Up @@ -177,10 +181,12 @@ private[zhttp] final case class Handler[R](
/**
* Executes program
*/
private def unsafeRunZIO(program: ZIO[R, Throwable, Any])(implicit ctx: Ctx): Unit =
private def unsafeRunZIO(program: ZIO[R, Throwable, Any])(implicit ctx: Ctx): Unit = {
log.info(s"Unsafe run $program")
rt.unsafeRun(ctx) {
program
}
}

override def serverTime: ServerTime = serverTimeGenerator

Expand Down

1 comment on commit 869e9fc

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance Benchmark:

Concurrency: 256
Requests/sec: 981944.20

Please sign in to comment.