Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout doesn't cancel correctly the HTTP client call #2848

Open
lmlynik opened this issue May 16, 2024 · 1 comment
Open

timeout doesn't cancel correctly the HTTP client call #2848

lmlynik opened this issue May 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lmlynik
Copy link

lmlynik commented May 16, 2024

Describe the bug
Certain sites which take long to respond cause that timeout doesn't cancel correctly.

test.com is such example

To Reproduce

//> using scala "2.13.10"
//> using lib "dev.zio::zio:2.1.1"
//> using lib "dev.zio::zio-http:3.0.0-RC6"

import zio._
import zio.http._

object Main extends ZIOAppDefault {
  val url = URL.decode("https://test.com").toOption.get

  val program = for {
    _ <- ZIO.log("Starting program")
    res <- ZClient.request(Request.get(url)).timeoutFail("Timeout")(1.seconds)
    data <- res.body.asString
    _ <- ZIO.log(data)
  } yield ()

  val run =
    program.catchAll(er => ZIO.logError(er)).provide(
      Client.default,
      Scope.default,
    )
}
timestamp=2024-05-16T17:32:47.171758467Z level=INFO thread=#zio-fiber-4 message="Starting program" location=<empty>.Main.program file=Main.scala line=10
timestamp=2024-05-16T17:33:47.551636313Z level=ERROR thread=#zio-fiber-4 message="Timeout" location=<empty>.Main.run file=Main.scala line=16

Expected behaviour
The Timeout error should come in after a 1 second, not 1 minute

@lmlynik lmlynik added the bug Something isn't working label May 16, 2024
@lmlynik
Copy link
Author

lmlynik commented May 16, 2024

Also the minute, the app doesn't terminates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant