restore environment-based queue names
This commit is contained in:
parent
e5f588e032
commit
8a207b3bc6
@ -98,6 +98,7 @@ def map_config(config):
|
|||||||
"default", "PERMANENT_SESSION_LIFETIME"
|
"default", "PERMANENT_SESSION_LIFETIME"
|
||||||
),
|
),
|
||||||
"RQ_REDIS_URL": config["default"]["REDIS_URI"],
|
"RQ_REDIS_URL": config["default"]["REDIS_URI"],
|
||||||
|
"RQ_QUEUES": ["atat_{}".format(ENV.lower())],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,11 +24,13 @@ class ATSTQueue(RQ):
|
|||||||
def _queue_job(self, function, *args, **kwargs):
|
def _queue_job(self, function, *args, **kwargs):
|
||||||
self.get_queue().enqueue(function, *args, **kwargs)
|
self.get_queue().enqueue(function, *args, **kwargs)
|
||||||
|
|
||||||
|
# pylint: disable=pointless-string-statement
|
||||||
"""Instance methods to queue up application-specific jobs."""
|
"""Instance methods to queue up application-specific jobs."""
|
||||||
|
|
||||||
def send_mail(self, to, subject, body):
|
def send_mail(self, to, subject, body):
|
||||||
self._queue_job(ATSTQueue._send_mail, to, subject, body)
|
self._queue_job(ATSTQueue._send_mail, to, subject, body)
|
||||||
|
|
||||||
|
# pylint: disable=pointless-string-statement
|
||||||
"""Class methods to actually perform the work.
|
"""Class methods to actually perform the work.
|
||||||
|
|
||||||
Must be a class method (or a module-level function) because we being able
|
Must be a class method (or a module-level function) because we being able
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from atst.queue import queue, send_mail
|
from atst.queue import queue
|
||||||
|
|
||||||
# ensure queue is always empty for unit testing
|
# ensure queue is always empty for unit testing
|
||||||
@pytest.fixture(scope="function", autouse=True)
|
@pytest.fixture(scope="function", autouse=True)
|
||||||
@ -11,7 +11,7 @@ def reset_queue():
|
|||||||
|
|
||||||
def test_send_mail():
|
def test_send_mail():
|
||||||
initial = len(queue.get_queue())
|
initial = len(queue.get_queue())
|
||||||
send_mail.queue(
|
queue.send_mail(
|
||||||
["lordvader@geocities.net"], "death start", "how is it coming along?"
|
["lordvader@geocities.net"], "death start", "how is it coming along?"
|
||||||
)
|
)
|
||||||
assert len(queue.get_queue()) == initial + 1
|
assert len(queue.get_queue()) == initial + 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user