This is an automated email from the ASF dual-hosted git repository.

markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 97bc8d5  Initialise trigger activation only when active rules are 
present. (#4112)
97bc8d5 is described below

commit 97bc8d568d96b975940dcebf38c325e5407d3869
Author: James Dubee <jwdu...@us.ibm.com>
AuthorDate: Wed Nov 14 13:48:14 2018 -0500

    Initialise trigger activation only when active rules are present. (#4112)
---
 .../openwhisk/core/controller/Triggers.scala       | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

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 291fb63..7320567 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))

Reply via email to