[GitHub] dubeejw commented on a change in pull request #202: Produce action fixes

2017-08-07 Thread git
dubeejw commented on a change in pull request #202: Produce action fixes
URL: 
https://github.com/apache/incubator-openwhisk-package-kafka/pull/202#discussion_r131716146
 
 

 ##
 File path: action/messageHubProduce.py
 ##
 @@ -196,7 +205,16 @@ def getProducer(validatedParams):
 logging.info("Reusing existing producer")
 return globals()["cached_producers"][connectionHash]
 
-
 def getConnectionHash(params):
 apiKey = "{}:{}".format(params['user'], params['password'])
 return apiKey
+
+# return the remaining time (in seconds) until the action will expire,
+# optionally reserving some time (also in seconds).
+def getRemainingTime(reservedTime=0):
+deadlineSeconds = int(os.getenv('__OW_DEADLINE', 6)) / 1000
 
 Review comment:
   `__OW_DEADLINE` is always a positive number, or 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dubeejw commented on a change in pull request #202: Produce action fixes

2017-08-07 Thread git
dubeejw commented on a change in pull request #202: Produce action fixes
URL: 
https://github.com/apache/incubator-openwhisk-package-kafka/pull/202#discussion_r131716146
 
 

 ##
 File path: action/messageHubProduce.py
 ##
 @@ -196,7 +205,16 @@ def getProducer(validatedParams):
 logging.info("Reusing existing producer")
 return globals()["cached_producers"][connectionHash]
 
-
 def getConnectionHash(params):
 apiKey = "{}:{}".format(params['user'], params['password'])
 return apiKey
+
+# return the remaining time (in seconds) until the action will expire,
+# optionally reserving some time (also in seconds).
+def getRemainingTime(reservedTime=0):
+deadlineSeconds = int(os.getenv('__OW_DEADLINE', 6)) / 1000
 
 Review comment:
   `__OW_DEADLINE` is always a positive number?
 

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:
us...@infra.apache.org


With regards,
Apache Git Services