diff --git a/retry_pattern/example.py b/retry_pattern/example.py index b0354e9..42dc068 100755 --- a/retry_pattern/example.py +++ b/retry_pattern/example.py @@ -75,12 +75,13 @@ def __init__(self): - @retryable(10, (ConnectionError, SomeOtherError)) + @retryable(1, (ConnectionError, SomeOtherError)) def get_job_from_database (self): """ Pretend this represents retrieval of job data from a database. A ConnectionError or SomeOtherError is a valid retryable exception. """ + self.i = self.i + 1 logging.info("i=%d" % self.i) if self.i < 3: raise ConnectionError("I'm a connection exception - please retry on this.") @@ -96,7 +97,6 @@ def run(self): """ hello, I do stuff in a loop, like look for new jobs to run.""" try: while (not self.stopped): - self.i = self.i + 1 job = self.get_job_from_database() if (job): @@ -134,4 +134,4 @@ def debug_start(): except KeyboardInterrupt: main.stop() -main.join() \ No newline at end of file +main.join()