diff --git a/rq/decorators.py b/rq/decorators.py index d1a7086..4d57c90 100644 --- a/rq/decorators.py +++ b/rq/decorators.py @@ -1,12 +1,12 @@ from functools import wraps from .queue import Queue from .connections import resolve_connection -from .worker import DEF_TTL +from .worker import DEFAULT_RESULT_TTL class job(object): def __init__(self, queue, connection=None, timeout=None, - result_ttl=DEF_TTL): + result_ttl=DEFAULT_RESULT_TTL): """A decorator that adds a ``delay`` method to the decorated function, which in turn creates a RQ job when called. Accepts a required ``queue`` argument that can be either a ``Queue`` instance or a string diff --git a/rq/worker.py b/rq/worker.py index 4d2b21d..cc99b4a 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -29,7 +29,7 @@ green = make_colorizer('darkgreen') yellow = make_colorizer('darkyellow') blue = make_colorizer('darkblue') -DEF_TTL = 500 +DEFAULT_RESULT_TTL = 500 class StopRequested(Exception): pass @@ -97,7 +97,7 @@ class Worker(object): return worker - def __init__(self, queues, name=None, default_result_ttl=DEF_TTL, + def __init__(self, queues, name=None, default_result_ttl=DEFAULT_RESULT_TTL, connection=None, exc_handler=None): # noqa if connection is None: connection = get_current_connection() diff --git a/tests/test_decorator.py b/tests/test_decorator.py index d669fbf..f00f1a3 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -3,7 +3,7 @@ from tests.fixtures import decorated_job from rq.decorators import job from rq.job import Job -from rq.worker import DEF_TTL +from rq.worker import DEFAULT_RESULT_TTL class TestDecorator(RQTestCase): @@ -41,7 +41,7 @@ class TestDecorator(RQTestCase): """ #Ensure default result = decorated_job.delay(1, 2) - self.assertEqual(result.result_ttl, DEF_TTL) + self.assertEqual(result.result_ttl, DEFAULT_RESULT_TTL) @job('default', result_ttl=10) def hello():