diff --git a/plextraktsync/decorators/time_limit.py b/plextraktsync/decorators/time_limit.py index b9b3fa4fe9..80d9a03510 100644 --- a/plextraktsync/decorators/time_limit.py +++ b/plextraktsync/decorators/time_limit.py @@ -1,22 +1,16 @@ -from functools import wraps - from plextraktsync.config import TRAKT_POST_DELAY from plextraktsync.util.Timer import Timer +from decorator import decorator + timer = Timer(TRAKT_POST_DELAY) -def time_limit(): +@decorator +def time_limit(fn, *args, **kwargs): """ Throttles calls not to be called more often than TRAKT_POST_DELAY """ + timer.wait_if_needed() - def decorator(fn): - @wraps(fn) - def wrapper(*args, **kwargs): - timer.wait_if_needed() - return fn(*args, **kwargs) - - return wrapper - - return decorator + return fn(*args, **kwargs)