You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/05 19:03:59 UTC
[GitHub] rabbah commented on a change in pull request #3187: reduce rule activation records
rabbah commented on a change in pull request #3187: reduce rule activation records
URL: https://github.com/apache/incubator-openwhisk/pull/3187#discussion_r166077958
##########
File path: core/controller/src/main/scala/whisk/core/controller/Triggers.scala
##########
@@ -413,12 +413,19 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
actionActivationId: Option[JsValue] = None,
errorMsg: Option[String] = None): JsObject = {
JsObject(
- "rule" -> JsString(ruleName.asString),
- "action" -> JsString(actionName.asString),
- "statusCode" -> JsNumber(statusCode),
- "success" -> JsBoolean(statusCode == ActivationResponse.Success),
- "activationId" -> actionActivationId.toJson,
- "error" -> errorMsg.toJson)
+ Map(
+ "rule" -> JsString(ruleName.asString),
+ "action" -> JsString(actionName.asString),
+ "statusCode" -> JsNumber(statusCode),
+ "success" -> JsBoolean(statusCode == ActivationResponse.Success)) ++ {
+ actionActivationId map { id =>
Review comment:
you can simplify this to:
```scala
JsObject(
Map(
"rule" -> JsString(ruleName.asString),
"action" -> JsString(actionName.asString),
"statusCode" -> JsNumber(statusCode),
"success" -> JsBoolean(statusCode == ActivationResponse.Success)) ++
actionActivationId.map("activationId" -> _.toJson) ++
errorMsg.map("error" -> JsString(_)))
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services