Created
December 8, 2017 01:43
-
-
Save piroyoung/3ad2ffed59df5eddfecd30d40d1a57e4 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
def retry_if_fail(callback: Callable): | |
""" | |
bigtable sdk auto-reconnect works only if failed. | |
:param callback: some callback function | |
:return: | |
""" | |
def wrap(*args, **kwargs): | |
try: | |
return callback(*args, **kwargs) | |
except: | |
time.sleep(1) | |
return callback(*args, **kwargs) | |
return wrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment