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 2020/03/06 08:34:32 UTC

[GitHub] [openwhisk-package-alarms] KeonHee opened a new pull request #208: Fixed strict option not working

KeonHee opened a new pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208
 
 
   #207 
   
   If you pass a boolean value as the parameter of alarmWebAction, it is passed as a boolean in the main function(even if you use wsk cli). But, since strict parameter is compared with string type, `strict = false` will work no matter what value is passed as parameter.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] style95 commented on a change in pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208#discussion_r393400950
 
 

 ##########
 File path: provider/lib/cronAlarm.js
 ##########
 @@ -123,4 +124,24 @@ module.exports = function(logger, newTrigger) {
         return limit;
     }
 
+    function isStrict(strict) {
+        /**
+         * If the strict variable is not passed from alarmWebAction(User doesn't define strict value),
+         * then the ALARM_DELAY_DEFAULT_STRICT environment variable value is used.
+         */
+        if(strict === undefined || strict === null) {
+            return delayDefaultStrict;
+        }
+
+        /**
+         * "true"(string)   -> true
+         * "false"(string)  -> false
+         * "True"(string)   -> true
+         * "False"(string)  -> false
+         * true(boolean)    -> true
+         * false(boolean)   -> false
+         */
+        return String(strict).toLowerCase() === "true";
 
 Review comment:
   oh ok, I meant the comments on codes but never mind.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] style95 commented on a change in pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208#discussion_r392561476
 
 

 ##########
 File path: provider/lib/cronAlarm.js
 ##########
 @@ -123,4 +124,24 @@ module.exports = function(logger, newTrigger) {
         return limit;
     }
 
+    function isStrict(strict) {
+        /**
+         * If the strict variable is not passed from alarmWebAction(User doesn't define strict value),
+         * then the ALARM_DELAY_DEFAULT_STRICT environment variable value is used.
+         */
+        if(strict === undefined || strict === null) {
+            return delayDefaultStrict;
+        }
+
+        /**
+         * "true"(string)   -> true
+         * "false"(string)  -> false
+         * "True"(string)   -> true
+         * "False"(string)  -> false
+         * true(boolean)    -> true
+         * false(boolean)   -> false
+         */
+        return String(strict).toLowerCase() === "true";
 
 Review comment:
   @KeonHee 
   If this is to let users use both `"true"` and `true` for the parameter, it would be great to leave comments about it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] KeonHee commented on a change in pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
KeonHee commented on a change in pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208#discussion_r393315397
 
 

 ##########
 File path: provider/lib/cronAlarm.js
 ##########
 @@ -123,4 +124,24 @@ module.exports = function(logger, newTrigger) {
         return limit;
     }
 
+    function isStrict(strict) {
+        /**
+         * If the strict variable is not passed from alarmWebAction(User doesn't define strict value),
+         * then the ALARM_DELAY_DEFAULT_STRICT environment variable value is used.
+         */
+        if(strict === undefined || strict === null) {
+            return delayDefaultStrict;
+        }
+
+        /**
+         * "true"(string)   -> true
+         * "false"(string)  -> false
+         * "True"(string)   -> true
+         * "False"(string)  -> false
+         * true(boolean)    -> true
+         * false(boolean)   -> false
+         */
+        return String(strict).toLowerCase() === "true";
 
 Review comment:
   Updated user documents as your comment :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] style95 commented on a change in pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208#discussion_r388805099
 
 

 ##########
 File path: provider/lib/cronAlarm.js
 ##########
 @@ -104,7 +104,7 @@ module.exports = function(logger, newTrigger) {
         var method = "distributeCronAlarm";
 
         var cronFields = (trigger.cron + '').trim().split(/\s+/);
-        if (trigger.strict !== 'true' && cronFields.length === 5 && delayLimit !== 0) {
+        if (!trigger.strict && cronFields.length === 5 && delayLimit !== 0) {
 
 Review comment:
   If a `strict` parameter does not exist, it will add some delays by default.
   So an OW operator can choose whether to enable this feature by setting up `ALARM_DELAY_LIMIT`.
   
   I think the documentation should be updated as well.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] style95 merged pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
style95 merged pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] style95 commented on a change in pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208#discussion_r388805099
 
 

 ##########
 File path: provider/lib/cronAlarm.js
 ##########
 @@ -104,7 +104,7 @@ module.exports = function(logger, newTrigger) {
         var method = "distributeCronAlarm";
 
         var cronFields = (trigger.cron + '').trim().split(/\s+/);
-        if (trigger.strict !== 'true' && cronFields.length === 5 && delayLimit !== 0) {
+        if (!trigger.strict && cronFields.length === 5 && delayLimit !== 0) {
 
 Review comment:
   If a `strict` parameter does not exist, it will add some delays by default.
   So an OW operator can choose whether to enable this feature by setting up `ALARM_DELAY_LIMIT` and once the feature is enabled, it will add delays by default if no `strict` parameter is set.
   
   I think the documentation should be updated as well.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [openwhisk-package-alarms] style95 commented on a change in pull request #208: Fixed strict option not working

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #208: Fixed strict option not working
URL: https://github.com/apache/openwhisk-package-alarms/pull/208#discussion_r393401663
 
 

 ##########
 File path: README.md
 ##########
 @@ -132,6 +132,8 @@ January 1, 2019, 00:00:00 UTC and will stop firing January 31, 2019, 23:59:00 UT
 
   - If it's true, the Trigger will fire at the top of the hour/minute (\**:**:00).
   - Otherwise, the Trigger will fire after the specific seconds (\**:**:00-59).
+  - If you do not set this value, it is set to the default chosen by the operator.
+  - Both `"true"` and `"false"` are recognized internally as boolean values.
 
 Review comment:
   How about this?
   ```suggestion
     - Optionally, string values, `"true"` and `"false"` are also recognized as boolean values.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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