1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

feat: Netbox plugin can defined their own RQ queues

This commit is contained in:
maximumG
2021-07-07 15:26:33 +02:00
parent 8b76db2bca
commit 995aa65f16
3 changed files with 16 additions and 0 deletions

View File

@ -52,6 +52,9 @@ class PluginConfig(AppConfig):
'*': {'ops': 'all'}, '*': {'ops': 'all'},
} }
# Django-rq queues dedicated to the plugin
queues = []
# Default integration paths. Plugin authors can override these to customize the paths to # Default integration paths. Plugin authors can override these to customize the paths to
# integrated components. # integrated components.
template_extensions = 'template_content.template_extensions' template_extensions = 'template_content.template_extensions'

View File

@ -12,6 +12,11 @@ class DummyPluginConfig(PluginConfig):
middleware = [ middleware = [
'extras.tests.dummy_plugin.middleware.DummyMiddleware' 'extras.tests.dummy_plugin.middleware.DummyMiddleware'
] ]
queues = [
'testing-low',
'testing-medium',
'testing-high'
]
config = DummyPluginConfig config = DummyPluginConfig

View File

@ -86,6 +86,14 @@ class PluginTest(TestCase):
""" """
self.assertIn('extras.tests.dummy_plugin.*', settings.CACHEOPS) self.assertIn('extras.tests.dummy_plugin.*', settings.CACHEOPS)
def test_queues(self):
"""
Check that plugin queues are registered with the accurate name.
"""
self.assertIn('extras.tests.dummy_plugin.testing-low', settings.RQ_QUEUES)
self.assertIn('extras.tests.dummy_plugin.testing-medium', settings.RQ_QUEUES)
self.assertIn('extras.tests.dummy_plugin.testing-high', settings.RQ_QUEUES)
def test_min_version(self): def test_min_version(self):
""" """
Check enforcement of minimum NetBox version. Check enforcement of minimum NetBox version.