This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-kafka.git
The following commit(s) were added to refs/heads/master by this push:
new a84f8e1 exponential backoff on trigger fire retry (#209)
a84f8e1 is described below
commit a84f8e1e573a1c3376d6201fc67cd41be04934ab
Author: Justin Berstler <[email protected]>
AuthorDate: Thu Aug 3 15:58:45 2017 -0400
exponential backoff on trigger fire retry (#209)
---
provider/consumer.py | 12 +++++-------
provider/thedoctor.py | 3 ++-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/provider/consumer.py b/provider/consumer.py
index b7fd732..727643a 100644
--- a/provider/consumer.py
+++ b/provider/consumer.py
@@ -114,9 +114,7 @@ class Consumer:
class ConsumerProcess (Process):
-
- retry_timeout = 1 # Timeout in seconds
- max_retries = 10 # Maximum number of times to retry firing trigger
+ max_retries = 6 # Maximum number of times to retry firing trigger
def __init__(self, trigger, params, sharedDictionary):
Process.__init__(self)
@@ -371,10 +369,10 @@ class ConsumerProcess (Process):
if retry:
retry_count += 1
- if retry_count < self.max_retries:
- logging.info("[{}] Retrying in {} second(s)".format(
- self.trigger, self.retry_timeout))
- time.sleep(self.retry_timeout)
+ if retry_count <= self.max_retries:
+ sleepyTime = pow(2,retry_count)
+ logging.info("[{}] Retrying in {}
second(s)".format(self.trigger, sleepyTime))
+ time.sleep(sleepyTime)
else:
logging.warn("[{}] Skipping {} messages to offset {}
of partition {}".format(self.trigger, len(messages), lastMessage.offset(),
lastMessage.partition()))
self.consumer.commit(offsets=self.__getOffsetList(messages), async=False)
diff --git a/provider/thedoctor.py b/provider/thedoctor.py
index 39eaada..4c28674 100644
--- a/provider/thedoctor.py
+++ b/provider/thedoctor.py
@@ -27,7 +27,8 @@ from threading import Thread
class TheDoctor (Thread):
# maximum time to allow a consumer to not successfully poll() before
restarting
- poll_timeout_seconds = 20
+ # this value must be greater than the total amount of time a consumer
might retry firing a trigger
+ poll_timeout_seconds = 200
# interval between the Doctor making rounds
sleepy_time_seconds = 2
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].