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/11/14 18:48:16 UTC

[GitHub] markusthoemmes closed pull request #4112: Create trigger activation only when active rule(s) are present

markusthoemmes closed pull request #4112: Create trigger activation only when active rule(s) are present
URL: https://github.com/apache/incubator-openwhisk/pull/4112
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Triggers.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Triggers.scala
index 291fb63b6f..73205676ba 100644
--- a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Triggers.scala
+++ b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Triggers.scala
@@ -141,24 +141,23 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
       entity(as[Option[JsObject]]) { payload =>
         getEntity(WhiskTrigger.get(entityStore, entityName.toDocId), Some {
           trigger: WhiskTrigger =>
-            val triggerActivationId = activationIdFactory.make()
-            logging.info(this, s"[POST] trigger activation id: ${triggerActivationId}")
-            val triggerActivation = WhiskActivation(
-              namespace = user.namespace.name.toPath, // all activations should end up in the one space regardless trigger.namespace,
-              entityName.name,
-              user.subject,
-              triggerActivationId,
-              Instant.now(Clock.systemUTC()),
-              Instant.EPOCH,
-              response = ActivationResponse.success(payload orElse Some(JsObject.empty)),
-              version = trigger.version,
-              duration = None)
-
             // List of active rules associated with the trigger
             val activeRules: Map[FullyQualifiedEntityName, ReducedRule] =
               trigger.rules.map(_.filter(_._2.status == Status.ACTIVE)).getOrElse(Map.empty)
 
             if (activeRules.nonEmpty) {
+              val triggerActivationId = activationIdFactory.make()
+              logging.info(this, s"[POST] trigger activation id: ${triggerActivationId}")
+              val triggerActivation = WhiskActivation(
+                namespace = user.namespace.name.toPath, // all activations should end up in the one space regardless trigger.namespace
+                entityName.name,
+                user.subject,
+                triggerActivationId,
+                Instant.now(Clock.systemUTC()),
+                Instant.EPOCH,
+                response = ActivationResponse.success(payload orElse Some(JsObject.empty)),
+                version = trigger.version,
+                duration = None)
               val args: JsObject = trigger.parameters.merge(payload).getOrElse(JsObject.empty)
 
               activateRules(user, args, trigger.rules.getOrElse(Map.empty))


 

----------------------------------------------------------------
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