Commit a823ad3c authored by Karthikeyan R's avatar Karthikeyan R
Browse files

Using config parameter for request timeout

Showing with 5 additions and 1 deletion
+5 -1
......@@ -26,6 +26,7 @@ abstract class BaseController(protected val cc: ControllerComponents)(implicit e
new util.HashMap[String, AnyRef]()).asInstanceOf[java.util.Map[String, AnyRef]]
val mimeTypesToCheck = List("application/vnd.ekstep.h5p-archive", "application/vnd.ekstep.html-archive", "application/vnd.android.package-archive",
"video/webm", "video/x-youtube", "video/mp4")
val actorTimeout: Long = Platform.getLong("actor.timeoutMillisec", 120000L)
def requestBody()(implicit request: Request[AnyContent]) = {
val body = request.body.asJson.getOrElse("{}").toString
......@@ -83,7 +84,7 @@ abstract class BaseController(protected val cc: ControllerComponents)(implicit e
}
def getResult(apiId: String, actor: ActorRef, request: org.sunbird.common.dto.Request, categoryMapping: Boolean = false, version: String = "3.0") : Future[Result] = {
val future = Patterns.ask(actor, request, 30000) recoverWith {case e: Exception => Future(ResponseHandler.getErrorResponse(e))}
val future = Patterns.ask(actor, request, actorTimeout) recoverWith {case e: Exception => Future(ResponseHandler.getErrorResponse(e))}
future.map(f => {
val result: Response = f.asInstanceOf[Response]
result.setId(apiId)
......
......@@ -736,3 +736,6 @@ collection {
}
}
}
#Request timeout
actor.timeoutMillisec = 120000
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment