Created
December 11, 2015 22:51
-
-
Save jriddy/ff8ef0ad0f6f58ea10b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@defer.inlineCallbacks | |
def retry(self, method, *args, **kwds): | |
for i in xrange(self.tries): | |
try: | |
result = yield method(*args, **kwds) | |
except: | |
if i == self.tries - 1: | |
raise | |
else: | |
defer.returnValue(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment