-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v3.4.2
Python version
3.10
Steps to Reproduce
- Create a test script
from extras.scripts import Script, StringVar
from tenancy.models import Tenant
class Script0(Script):
def run(self, data, commit):
tenant = Tenant(name="test", slug="test")
tenant.save()
- Run the script and mark commit as false
Expected Behavior
The rqworker should not throw an exception and the job should not show up in "Failed jobs" in the admin page.
Observed Behavior
The rqworker will throw the following exception:
Traceback (most recent call last):
File "/home/main/devel/repos/netbox/venv/lib/python3.10/site-packages/rq/worker.py", line 1075, in perform_job
rv = job.perform()
File "/home/main/devel/repos/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 854, in perform
self._result = self._execute()
File "/home/main/devel/repos/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 877, in _execute
result = self.func(*self.args, **self.kwargs)
File "/home/main/devel/repos/netbox/netbox/extras/scripts.py", line 494, in run_script
_run_script()
File "/home/main/devel/repos/netbox/netbox/extras/scripts.py", line 472, in _run_script
clear_webhooks.send(request)
File "/home/main/devel/repos/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send
return [
File "/home/main/devel/repos/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/home/main/devel/repos/netbox/netbox/extras/signals.py", line 131, in clear_webhook_queue
logger.info(f"Clearing {len(webhooks_queue.get())} queued webhooks ({sender})")
LookupError: <ContextVar name='webhooks_queue' at 0x7f446427acf0>
The same exception can be seen in the admin panel when watching the queues.
Seems to be caused by this: #10883
Can you take a look at this @jeremystretch - not sure I understand what the exact issue is.
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application