Skip to content

Commit

Permalink
err, move this increment to the right spot.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jen Andre committed Apr 17, 2011
1 parent 8317043 commit 61eff21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions retry_pattern/example.py
Expand Up @@ -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.")
Expand All @@ -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):
Expand Down Expand Up @@ -134,4 +134,4 @@ def debug_start():
except KeyboardInterrupt:
main.stop()

main.join()
main.join()

0 comments on commit 61eff21

Please sign in to comment.