[PR #10883] [MERGED] Closes #9439: Ensure thread safety of change logging functions #13708

Closed
opened 2025-12-29 23:20:22 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/10883
Author: @jeremystretch
Created: 11/10/2022
Status: Merged
Merged: 11/14/2022
Merged by: @jeremystretch

Base: developHead: 9439-multi-threading


📝 Commits (2)

  • 0f33698 Use context vars instead of thread-local storage for change logging
  • bd00c86 Permanently connect change logging & webhook receivers

📊 Changes

5 files changed (+55 additions, -59 deletions)

View changed files

📝 netbox/extras/context_managers.py (+7 -24)
📝 netbox/extras/signals.py (+38 -23)
📝 netbox/netbox/__init__.py (+0 -3)
netbox/netbox/context.py (+10 -0)
netbox/netbox/request_context.py (+0 -9)

📄 Description

Fixes: #9439

  • Remove signal handler connects & disconnects from change_logging() context manger
  • Use ContextVar rather than thread-local storage to hold the current request and webhooks queue

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/10883 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 11/10/2022 **Status:** ✅ Merged **Merged:** 11/14/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `9439-multi-threading` --- ### 📝 Commits (2) - [`0f33698`](https://github.com/netbox-community/netbox/commit/0f3369800460634722ac77711743f28e19f88e93) Use context vars instead of thread-local storage for change logging - [`bd00c86`](https://github.com/netbox-community/netbox/commit/bd00c86ba70f9d6ae8737c317ddd065d0679bffd) Permanently connect change logging & webhook receivers ### 📊 Changes **5 files changed** (+55 additions, -59 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/context_managers.py` (+7 -24) 📝 `netbox/extras/signals.py` (+38 -23) 📝 `netbox/netbox/__init__.py` (+0 -3) ➕ `netbox/netbox/context.py` (+10 -0) ➖ `netbox/netbox/request_context.py` (+0 -9) </details> ### 📄 Description ### Fixes: #9439 - Remove signal handler connects & disconnects from `change_logging()` context manger - Use `ContextVar` rather than thread-local storage to hold the current request and webhooks queue --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:20:22 +01:00
adam closed this issue 2025-12-29 23:20:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13708