Adjust RQ job priorities (#4301)

* prioritize periodic jobs

* declare default queues in inside worker()

* separate send_email to its own queue
This commit is contained in:
Omer Lachish 2019-11-06 13:36:27 +02:00 committed by GitHub
parent cce6546a62
commit 6f791a092b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,6 @@ services:
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
QUEUES: "default periodic schemas"
celery-worker:
build: .
command: dev_celery_worker

View File

@ -22,14 +22,15 @@ def scheduler():
@manager.command()
@argument('queues', nargs=-1)
def worker(queues='default'):
def worker(queues):
# Configure any SQLAlchemy mappers loaded until now so that the mapping configuration
# will already be available to the forked work horses and they won't need
# to spend valuable time re-doing that on every fork.
configure_mappers()
if not queues:
queues = ('default',)
queues = ['periodic', 'emails', 'default', 'schemas']
with Connection(rq_redis_connection):
w = Worker(queues)
w.work()

View File

@ -45,7 +45,7 @@ def subscribe(form):
requests.post('https://beacon.redash.io/subscribe', json=data)
@job('default')
@job('emails')
def send_mail(to, subject, html, text):
try:
message = Message(recipients=to,