mirror of https://github.com/rq/rq.git
Rename the const.
This commit is contained in:
parent
538bbb1b55
commit
5e59c6e28e
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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():
|
||||
|
|
Loading…
Reference in New Issue