0
votes

I have a basic client which I use to test my server. For the configuration I am using application.json

"spray": {
  "can": {
    "client": {
      "idle-timeout": "120 s",
      "request-timeout": "180 s"
    },
    "host-connector": {
      "max-retries": "1",
      "max-connections": "64"
    }
  }
}

however in the sendrecieve method i see that the timeout is always 60 sec , as according to the documantation , if I use request-timeout it suppose to be the implicit value

def sendReceive(implicit refFactory: ActorRefFactory, executionContext: ExecutionContext,
              futureTimeout: Timeout = 60.seconds): SendReceive =
sendReceive(IO(Http)(actorSystem))

Do I need explicitly to load the configuration?

1

1 Answers

1
votes

This is a confusing aspect of spary's various timeout values, for a detailed explanation see: Understanding Spray Client Timeout Settings

A couple of points about the method definition above, the timeout is just used to satisfy the timeout required by the ask made to the transport actor, it does not relate to a request timeout for this connection. futureTimeout: Timeout = 60.seconds means that this default value of is used if none is provided, not that it is unconditionally used.

You can programmatically configure the requestTimeout by passing a HostConnectorSetup to either the host or request level API's, as you already have this in your spray.can.client configuration though you should not need to make further changes.