markusthoemmes commented on a change in pull request #2218: Port Controller
from Spray to Akka
URL:
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r130339431
##########
File path: core/controller/src/main/scala/whisk/core/controller/Actions.scala
##########
@@ -619,18 +626,33 @@ trait WhiskActionsApi
/** Max atomic action count allowed for sequences */
private lazy val actionSequenceLimit =
whiskConfig.actionSequenceLimit.toInt
- /** Custom deserializer for timeout query parameter. */
- private implicit val stringToTimeoutDeserializer = new
FromStringDeserializer[FiniteDuration] {
- val max = WhiskActionsApi.maxWaitForBlockingActivation.toMillis
- def apply(msecs: String): Either[DeserializationError, FiniteDuration]
= {
- Try { msecs.toInt } match {
- case Success(i) if i > 0 && i <= max => Right(i.milliseconds)
- case _ => Left {
-
MalformedContent(Messages.invalidTimeout(WhiskActionsApi.maxWaitForBlockingActivation))
- }
+ implicit val stringToFiniteDuration: Unmarshaller[String, FiniteDuration]
= {
+ Unmarshaller.strict[String, FiniteDuration] { value =>
+ val max = WhiskActionsApi.maxWaitForBlockingActivation.toMillis
+
+ Try {
+ value.toInt
+ } match {
+ case Success(i) if i > 0 && i <= max => i.milliseconds
+ case _ => throw new
IllegalArgumentException(Messages.invalidTimeout(WhiskActionsApi.maxWaitForBlockingActivation))
}
}
}
+
+ implicit val entityToJsObject: Unmarshaller[HttpEntity, JsObject] = {
Review comment:
Shouldn't this be solved via:
http://doc.akka.io/docs/akka-http/10.0.7/scala/http/common/json-support.html#spray-json-support
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services