mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Log a warning when rqworker invoked without specified queues
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
from django.conf import settings
|
||||
import logging
|
||||
|
||||
from django_rq.management.commands.rqworker import Command as _Command
|
||||
|
||||
|
||||
DEFAULT_QUEUES = ('high', 'default', 'low')
|
||||
|
||||
logger = logging.getLogger('netbox.rqworker')
|
||||
|
||||
|
||||
class Command(_Command):
|
||||
"""
|
||||
Subclass django_rq's built-in rqworker to listen on all configured queues if none are specified (instead
|
||||
@ -11,6 +17,10 @@ class Command(_Command):
|
||||
|
||||
# If no queues have been specified on the command line, listen on all configured queues.
|
||||
if len(args) < 1:
|
||||
args = settings.RQ_QUEUES
|
||||
queues = ', '.join(DEFAULT_QUEUES)
|
||||
logger.warning(
|
||||
f"No queues have been specified. This process will service the following queues by default: {queues}"
|
||||
)
|
||||
args = DEFAULT_QUEUES
|
||||
|
||||
super().handle(*args, **options)
|
||||
|
Reference in New Issue
Block a user