Skip to content

Commit

Permalink
Adjust RQ job priorities (#4301)
Browse files Browse the repository at this point in the history
* prioritize periodic jobs

* declare default queues in inside worker()

* separate send_email to its own queue
  • Loading branch information
Omer Lachish authored Nov 6, 2019
1 parent cce6546 commit 6f791a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions redash/cli/rq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion redash/tasks/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6f791a0

Please sign in to comment.