diff --git a/rq/queue.py b/rq/queue.py index 090997e..06998d9 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -192,6 +192,8 @@ class Queue(object): contain options for RQ itself. """ timeout = parse_timeout(timeout) or self._default_timeout + result_ttl = parse_timeout(result_ttl) + ttl = parse_timeout(ttl) job = self.job_class.create( func, args=args, kwargs=kwargs, connection=self.connection, diff --git a/rq/utils.py b/rq/utils.py index d7ec53c..92da521 100644 --- a/rq/utils.py +++ b/rq/utils.py @@ -253,12 +253,12 @@ def parse_timeout(timeout): timeout = int(timeout) except ValueError: digit, unit = timeout[:-1], (timeout[-1:]).lower() - unit_second = {'h': 3600, 'm': 60, 's': 1} + unit_second = {'d': 86400, 'h': 3600, 'm': 60, 's': 1} try: timeout = int(digit) * unit_second[unit] except (ValueError, KeyError): raise TimeoutFormatError('Timeout must be an integer or a string representing an integer, or ' - 'a string with format: digits + unit, unit can be "h", "m", "s", ' + 'a string with format: digits + unit, unit can be "d", "h", "m", "s", ' 'such as "1h", "23m".') return timeout