openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From berst...@apache.org
Subject [incubator-openwhisk-package-cloudant] branch master updated: make sure trigger that has been deleted is no longer in memory (#120)
Date Fri, 21 Jul 2017 17:17:35 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 1b7c7ff  make sure trigger that has been deleted is no longer in memory (#120)
1b7c7ff is described below

commit 1b7c7ff41353e57448e41cd003b318c86ac5494d
Author: Jason Peterson <jasonpet@us.ibm.com>
AuthorDate: Fri Jul 21 13:17:34 2017 -0400

    make sure trigger that has been deleted is no longer in memory (#120)
---
 provider/lib/utils.js | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index 38d9c1f..31ba55b 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -149,7 +149,9 @@ module.exports = function(
                     }
                 }
                 else {
-                    logger.error(method, 'there was an error while getting', id, 'from database',
err);
+                    logger.info(method, 'could not find', id, 'in database');
+                    //make sure it is removed from memory as well
+                    utils.deleteTrigger(id);
                 }
             });
         }
@@ -159,12 +161,14 @@ module.exports = function(
     this.deleteTrigger = function(triggerIdentifier) {
         var method = 'deleteTrigger';
 
-        if (utils.triggers[triggerIdentifier].feed) {
-            utils.triggers[triggerIdentifier].feed.stop();
-        }
+        if (utils.triggers[triggerIdentifier]) {
+            if (utils.triggers[triggerIdentifier].feed) {
+                utils.triggers[triggerIdentifier].feed.stop();
+            }
 
-        delete utils.triggers[triggerIdentifier];
-        logger.info(method, 'trigger', triggerIdentifier, 'successfully deleted from memory');
+            delete utils.triggers[triggerIdentifier];
+            logger.info(method, 'trigger', triggerIdentifier, 'successfully deleted from
memory');
+        }
     };
 
     this.fireTrigger = function(triggerIdentifier, change) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message