Why do we need to decrement counter (and use counter at all)?

Is the following approach bad?

def time_limit(seconds):
    def decorator(func):
        func.info = threading.local()
        
        def check_timeout():
                if time.time() > func.info.end_time:
                    raise TimeoutException

        func.check_timeout = check_timeout

        @functools.wraps(func)
        def wrapper(*args, **kwargs):
*            if not hasattr(func.info, 'end_time'):*
*                func.info.end_time = time.time() + seconds*
            return func(*args, **kwargs)

        return wrapper

    return decorator

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to