Skip to content

Instantly share code, notes, and snippets.

@nooperpudd
Last active May 14, 2018 02:36
Show Gist options
  • Save nooperpudd/7a37bfa6836a176116b092aff1e40d3d to your computer and use it in GitHub Desktop.
Save nooperpudd/7a37bfa6836a176116b092aff1e40d3d to your computer and use it in GitHub Desktop.
def _transaction(watch_arg=None, use_pipe=True, ):
# """
# wrapper class
# :return:
# """
#
# def wrapper(func):
# """
# :return:
# """
#
# @functools.wraps(func)
# def inner(self, *args, **kwargs):
# """
# :param self: class instance
# :param args:
# :param kwargs:
# :return:
# """
# trans = getattr(self, "transaction")
# redis_client = getattr(self, "client", None)
#
# call_args = inspect.getcallargs(func, **kwargs)
# watch_value = call_args.get(watch_arg)
# if redis_client and trans:
#
# result = None
# try:
# redis_client.watch(watch_value)
# result = func(self, *args, **kwargs)
# except redis.WatchError:
# continue
# else:
# redis_client.unwatch()
# return result
#
#
# else:
# return func(self, *args, **kwargs)
#
# return inner
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment