huskar_api/models/utils.py
def retry(exceptions, interval, max_retry):
    """A decorator with arguments to make view functions could be retried.

    :param exceptions: The tuple of exception set.
    :param interval: The sleep interval in seconds.
    :param max_retry: The max retry times.
    """
    def decorator(wrapped):
        @functools.wraps(wrapped)
        def wrapper(*args, **kwargs):
            for i in xrange(max_retry):
                try:
                    return wrapped(*args, **kwargs)
                except exceptions:
                    if i == max_retry - 1:
                        raise
                    sleep(interval)
        return wrapper
    return decorator
A decorator with arguments to make view functions could be retried.

    :param exceptions: The tuple of exception set.
    :param interval: The sleep interval in seconds.
    :param max_retry: The max retry times.
    
A decorator with arguments to make view functions could be retried.
A decorator with arguments to make view functions could be retried .
def retry(exceptions, interval, max_retry):
    def decorator(wrapped):
        @functools.wraps(wrapped)
        def wrapper(*args, **kwargs):
            for i in xrange(max_retry):
                try:
                    return wrapped(*args, **kwargs)
                except exceptions:
                    if i == max_retry - 1:
                        raise
                    sleep(interval)
        return wrapper
    return decorator
def retry ( exceptions , interval , max_retry ) : def decorator ( wrapped ) : @ functools . wraps ( wrapped ) def wrapper ( * args , ** kwargs ) : for i in xrange ( max_retry ) : try : return wrapped ( * args , ** kwargs ) except exceptions : if i == max_retry - 1 : raise sleep ( interval ) return wrapper return decorator
A decorator with arguments to make view functions could be retried.
A decorator with arguments to make view functions could be retried .
"""A decorator with arguments to make view functions could be retried.

    :param exceptions: The tuple of exception set.
    :param interval: The sleep interval in seconds.
    :param max_retry: The max retry times.
    """
exceptions
The tuple of exception set.
The tuple of exception set .
interval
The sleep interval in seconds.
The sleep interval in seconds .
max_retry
The max retry times.
The max retry times .